Use tryToUseAsIndex in Array.prototype.join

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2025-12-23 13:19:01 +09:00 committed by Boram Bae
commit e74404b9a2
2 changed files with 5 additions and 7 deletions

View file

@ -791,8 +791,8 @@ static Value builtinArrayJoin(ExecutionState& state, Value thisValue, size_t arg
if (elem.isUndefined()) {
struct Data {
bool exists;
int64_t cur;
int64_t ret;
Value::ValueIndex cur;
Value::ValueIndex ret;
} data;
data.exists = false;
data.cur = curIndex;
@ -805,12 +805,11 @@ static Value builtinArrayJoin(ExecutionState& state, Value thisValue, size_t arg
break;
}
ptr.asObject()->enumeration(state, [](ExecutionState& state, Object* self, const ObjectPropertyName& name, const ObjectStructurePropertyDescriptor& desc, void* data) {
int64_t index;
Data* e = (Data*)data;
int64_t* ret = &e->ret;
Value::ValueIndex* ret = &e->ret;
Value key = name.toPlainValue();
index = key.toNumber(state);
if ((uint64_t)index != Value::InvalidIndexValue) {
Value::ValueIndex index = key.tryToUseAsIndex(state);
if (index != Value::InvalidIndexValue) {
if (self->get(state, name).value(state, self).isUndefined()) {
return true;
}

View file

@ -27,7 +27,6 @@
<test id="built-ins/AbstractModuleSource/prototype/constructor"><reason>TODO</reason></test>
<test id="built-ins/AbstractModuleSource/prototype/proto"><reason>TODO</reason></test>
<test id="built-ins/AbstractModuleSource/throw-from-constructor"><reason>TODO</reason></test>
<test id="built-ins/Array/prototype/join/coerced-separator-shrink"><reason>TODO</reason></test>
<test id="built-ins/ArrayBuffer/prototype/resizable/detached-buffer"><reason>TODO</reason></test>
<test id="built-ins/ArrayBuffer/prototype/resize/coerced-new-length-detach"><reason>TODO</reason></test>
<test id="built-ins/ArrayBuffer/prototype/resize/this-is-immutable-arraybuffer-object"><reason>TODO</reason></test>