mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Fix computed reference on null or undefined
This commit is contained in:
parent
acc0dd9273
commit
52e0f24048
2 changed files with 20 additions and 10 deletions
28
quickjs.c
28
quickjs.c
|
@ -8159,15 +8159,27 @@ static JSValue JS_GetPropertyValue(JSContext *ctx, JSValue this_obj,
|
||||||
{
|
{
|
||||||
JSAtom atom;
|
JSAtom atom;
|
||||||
JSValue ret;
|
JSValue ret;
|
||||||
|
uint32_t tag;
|
||||||
|
|
||||||
if (likely(JS_VALUE_GET_TAG(this_obj) == JS_TAG_OBJECT &&
|
tag = JS_VALUE_GET_TAG(this_obj);
|
||||||
JS_VALUE_GET_TAG(prop) == JS_TAG_INT)) {
|
if (likely(tag == JS_TAG_OBJECT)) {
|
||||||
JSObject *p = JS_VALUE_GET_OBJ(this_obj);
|
if (JS_VALUE_GET_TAG(prop) == JS_TAG_INT) {
|
||||||
uint32_t idx = JS_VALUE_GET_INT(prop);
|
JSObject *p = JS_VALUE_GET_OBJ(this_obj);
|
||||||
JSValue val;
|
uint32_t idx = JS_VALUE_GET_INT(prop);
|
||||||
/* fast path for array and typed array access */
|
JSValue val;
|
||||||
if (js_get_fast_array_element(ctx, p, idx, &val))
|
/* fast path for array and typed array access */
|
||||||
return val;
|
if (js_get_fast_array_element(ctx, p, idx, &val))
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch(tag) {
|
||||||
|
case JS_TAG_NULL:
|
||||||
|
JS_FreeValue(ctx, prop);
|
||||||
|
return JS_ThrowTypeError(ctx, "cannot read property of null");
|
||||||
|
case JS_TAG_UNDEFINED:
|
||||||
|
JS_FreeValue(ctx, prop);
|
||||||
|
return JS_ThrowTypeError(ctx, "cannot read property of undefined");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
atom = JS_ValueToAtom(ctx, prop);
|
atom = JS_ValueToAtom(ctx, prop);
|
||||||
JS_FreeValue(ctx, prop);
|
JS_FreeValue(ctx, prop);
|
||||||
|
|
|
@ -628,7 +628,5 @@ test262/test/language/expressions/assignment/target-super-computed-reference.js:
|
||||||
test262/test/language/expressions/assignment/target-super-computed-reference.js:20: strict mode: Test262Error: Expected a DummyError but got a Test262Error
|
test262/test/language/expressions/assignment/target-super-computed-reference.js:20: strict mode: Test262Error: Expected a DummyError but got a Test262Error
|
||||||
test262/test/language/expressions/in/private-field-invalid-assignment-target.js:23: unexpected error type: Test262: This statement should not be evaluated.
|
test262/test/language/expressions/in/private-field-invalid-assignment-target.js:23: unexpected error type: Test262: This statement should not be evaluated.
|
||||||
test262/test/language/expressions/in/private-field-invalid-assignment-target.js:23: strict mode: unexpected error type: Test262: This statement should not be evaluated.
|
test262/test/language/expressions/in/private-field-invalid-assignment-target.js:23: strict mode: unexpected error type: Test262: This statement should not be evaluated.
|
||||||
test262/test/language/expressions/member-expression/computed-reference-null-or-undefined.js:28: Test262Error: Expected a TypeError but got a Test262Error
|
|
||||||
test262/test/language/expressions/member-expression/computed-reference-null-or-undefined.js:28: strict mode: Test262Error: Expected a TypeError but got a Test262Error
|
|
||||||
test262/test/language/module-code/top-level-await/async-module-does-not-block-sibling-modules.js:13: SyntaxError: Could not find export 'check' in module 'test262/test/language/module-code/top-level-await/async-module-sync_FIXTURE.js'
|
test262/test/language/module-code/top-level-await/async-module-does-not-block-sibling-modules.js:13: SyntaxError: Could not find export 'check' in module 'test262/test/language/module-code/top-level-await/async-module-sync_FIXTURE.js'
|
||||||
test262/test/staging/top-level-await/tla-hang-entry.js:10: TypeError: $DONE() not called
|
test262/test/staging/top-level-await/tla-hang-entry.js:10: TypeError: $DONE() not called
|
||||||
|
|
Loading…
Reference in a new issue