From 9539e3cc65ceae3e760abc96e639baa74a58368d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 7 Dec 2023 22:08:06 +0100 Subject: [PATCH] Fix private field setters Ref: https://github.com/bellard/quickjs/commit/55a4878a605a6707b1754b4b807deec62c8fc895 --- quickjs-opcode.h | 2 +- quickjs.c | 3 ++- test262_errors.txt | 30 ------------------------------ 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/quickjs-opcode.h b/quickjs-opcode.h index bec75d7..e06d52c 100644 --- a/quickjs-opcode.h +++ b/quickjs-opcode.h @@ -277,7 +277,7 @@ def( scope_get_ref, 7, 0, 2, atom_u16) /* emitted in phase 1, removed in phase def(scope_put_var_init, 7, 0, 2, atom_u16) /* emitted in phase 1, removed in phase 2 */ def(scope_get_private_field, 7, 1, 1, atom_u16) /* obj -> value, emitted in phase 1, removed in phase 2 */ def(scope_get_private_field2, 7, 1, 2, atom_u16) /* obj -> obj value, emitted in phase 1, removed in phase 2 */ -def(scope_put_private_field, 7, 1, 1, atom_u16) /* obj value ->, emitted in phase 1, removed in phase 2 */ +def(scope_put_private_field, 7, 2, 0, atom_u16) /* obj value ->, emitted in phase 1, removed in phase 2 */ def( set_class_name, 5, 1, 1, u32) /* emitted in phase 1, removed in phase 2 */ diff --git a/quickjs.c b/quickjs.c index 01efce3..110793c 100644 --- a/quickjs.c +++ b/quickjs.c @@ -28271,6 +28271,7 @@ static int resolve_scope_private_field(JSContext *ctx, JSFunctionDef *s, /* obj func value */ dbuf_putc(bc, OP_call_method); dbuf_put_u16(bc, 1); + dbuf_putc(bc, OP_drop); } break; default: @@ -30273,7 +30274,7 @@ static __exception int ss_check(JSContext *ctx, StackSizeState *s, if (s->stack_level_tab[pos] != 0xffff) { /* already explored: check that the stack size is consistent */ if (s->stack_level_tab[pos] != stack_len) { - JS_ThrowInternalError(ctx, "unconsistent stack size: %d %d (pc=%d)", + JS_ThrowInternalError(ctx, "inconsistent stack size: %d %d (pc=%d)", s->stack_level_tab[pos], stack_len, pos); return -1; } else { diff --git a/test262_errors.txt b/test262_errors.txt index e8cadc4..c4cfe8d 100644 --- a/test262_errors.txt +++ b/test262_errors.txt @@ -98,30 +98,6 @@ test262/test/language/expressions/assignment/target-member-computed-reference-nu test262/test/language/expressions/assignment/target-member-computed-reference-null.js:32: strict mode: Test262Error: Expected a DummyError but got a TypeError test262/test/language/expressions/assignment/target-member-computed-reference-undefined.js:32: Test262Error: Expected a DummyError but got a TypeError test262/test/language/expressions/assignment/target-member-computed-reference-undefined.js:32: strict mode: Test262Error: Expected a DummyError but got a TypeError -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «0») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «0») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «15») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «15») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «257») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «257») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «0.5») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «0.5») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1000») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1000») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «96») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «96») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «6») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «6») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true -test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true test262/test/language/expressions/delete/super-property-null-base.js:26: Test262Error: Expected a ReferenceError but got a TypeError test262/test/language/expressions/delete/super-property-null-base.js:26: strict mode: Test262Error: Expected a ReferenceError but got a TypeError test262/test/language/expressions/dynamic-import/usage-from-eval.js:26: TypeError: $DONE() not called @@ -130,12 +106,6 @@ test262/test/language/expressions/function/static-init-await-binding.js:16: Synt test262/test/language/expressions/function/static-init-await-binding.js:16: strict mode: SyntaxError: 'await' is a reserved identifier test262/test/language/expressions/generators/static-init-await-binding.js:16: SyntaxError: 'await' is a reserved identifier test262/test/language/expressions/generators/static-init-await-binding.js:16: strict mode: SyntaxError: 'await' is a reserved identifier -test262/test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-and.js:60: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «false») to be true -test262/test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-and.js:60: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «false») to be true -test262/test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-nullish.js:59: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true -test262/test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-nullish.js:59: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true -test262/test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-or.js:60: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «true») to be true -test262/test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-or.js:60: strict mode: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «true») to be true test262/test/language/expressions/optional-chaining/optional-call-preserves-this.js:21: TypeError: cannot read property 'c' of undefined test262/test/language/expressions/optional-chaining/optional-call-preserves-this.js:15: strict mode: TypeError: cannot read property '_b' of undefined test262/test/language/global-code/script-decl-lex-var-declared-via-eval-sloppy.js:13: Test262Error: variable Expected a SyntaxError to be thrown but no exception was thrown at all