From 3fad0e27b043de8ebfd39e021e214b401bcc1117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Thu, 16 Sep 2021 19:32:10 +0800 Subject: [PATCH] Chore: add class static blocks tests acorn has been upgraded in ee1d3ec, this commit simply added some tests. The tests were copied from test262, refs: tc39/test262@afe217b --- ...nction-static-init-await-binding.result.js | 6 + ...-function-static-init-await-binding.src.js | 18 + ...tion-static-init-await-reference.result.js | 6 + ...unction-static-init-await-reference.src.js | 18 + ...-class-static-init-await-binding.result.js | 6 + ...ons-class-static-init-await-binding.src.js | 23 + ...atic-init-await-reference.module-result.js | 6 + ...lass-static-init-await-reference.result.js | 1951 ++++ ...s-class-static-init-await-reference.src.js | 28 + ...static-init-await-binding.module-result.js | 6 + ...nction-static-init-await-binding.result.js | 495 + ...-function-static-init-await-binding.src.js | 18 + ...atic-init-await-reference.module-result.js | 6 + ...tion-static-init-await-reference.result.js | 1840 ++++ ...unction-static-init-await-reference.src.js | 26 + ...static-init-await-binding.module-result.js | 6 + ...rators-static-init-await-binding.result.js | 513 + ...enerators-static-init-await-binding.src.js | 18 + ...atic-init-await-reference.module-result.js | 6 + ...tors-static-init-await-reference.result.js | 1986 ++++ ...erators-static-init-await-reference.src.js | 26 + ...p-name-literal-await-static-init.result.js | 460 + ...prop-name-literal-await-static-init.src.js | 22 + ...rthand-static-init-await-invalid.result.js | 6 + ...shorthand-static-init-await-invalid.src.js | 26 + ...d-static-init-await-valid.module-result.js | 6 + ...horthand-static-init-await-valid.result.js | 535 + ...r-shorthand-static-init-await-valid.src.js | 18 + ...it-await-binding-accessor.module-result.js | 6 + ...atic-init-await-binding-accessor.result.js | 572 ++ ...-static-init-await-binding-accessor.src.js | 18 + ...t-await-binding-generator.module-result.js | 6 + ...tic-init-await-binding-generator.result.js | 572 ++ ...static-init-await-binding-generator.src.js | 18 + ...init-await-binding-normal.module-result.js | 6 + ...static-init-await-binding-normal.result.js | 554 + ...on-static-init-await-binding-normal.src.js | 18 + ...-await-reference-accessor.module-result.js | 6 + ...ic-init-await-reference-accessor.result.js | 2042 ++++ ...tatic-init-await-reference-accessor.src.js | 28 + ...await-reference-generator.module-result.js | 6 + ...c-init-await-reference-generator.result.js | 2153 ++++ ...atic-init-await-reference-generator.src.js | 28 + ...it-await-reference-normal.module-result.js | 6 + ...atic-init-await-reference-normal.result.js | 2007 ++++ ...-static-init-await-reference-normal.src.js | 28 + ...lution-static-init-invalid-await.result.js | 6 + ...esolution-static-init-invalid-await.src.js | 25 + ...-break-static-init-without-label.result.js | 6 + ...nts-break-static-init-without-label.src.js | 27 + ...tements-class-static-init-abrupt.result.js | 3451 +++++++ ...statements-class-static-init-abrupt.src.js | 46 + ...-static-init-arguments-functions.result.js | 5588 ++++++++++ ...ass-static-init-arguments-functions.src.js | 40 + ...ss-static-init-arguments-methods.result.js | 9111 +++++++++++++++++ ...class-static-init-arguments-methods.src.js | 58 + ...tatic-init-await-binding-invalid.result.js | 6 + ...s-static-init-await-binding-invalid.src.js | 26 + ...-init-await-binding-valid.module-result.js | 6 + ...-static-init-await-binding-valid.result.js | 550 + ...ass-static-init-await-binding-valid.src.js | 18 + ...lass-static-init-expr-new-target.result.js | 890 ++ ...s-class-static-init-expr-new-target.src.js | 23 + ...ents-class-static-init-expr-this.result.js | 764 ++ ...tements-class-static-init-expr-this.src.js | 23 + ...ss-static-init-invalid-arguments.result.js | 6 + ...class-static-init-invalid-arguments.src.js | 23 + ...-class-static-init-invalid-await.result.js | 6 + ...nts-class-static-init-invalid-await.src.js | 33 + ...ss-static-init-invalid-label-dup.result.js | 6 + ...class-static-init-invalid-label-dup.src.js | 24 + ...lass-static-init-invalid-lex-dup.result.js | 6 + ...s-class-static-init-invalid-lex-dup.src.js | 24 + ...lass-static-init-invalid-lex-var.result.js | 6 + ...s-class-static-init-invalid-lex-var.src.js | 25 + ...class-static-init-invalid-return.result.js | 6 + ...ts-class-static-init-invalid-return.src.js | 27 + ...s-static-init-invalid-super-call.result.js | 6 + ...lass-static-init-invalid-super-call.src.js | 22 + ...t-invalid-undefined-break-target.result.js | 6 + ...init-invalid-undefined-break-target.src.js | 25 + ...nvalid-undefined-continue-target.result.js | 6 + ...t-invalid-undefined-continue-target.src.js | 25 + ...-class-static-init-invalid-yield.result.js | 6 + ...nts-class-static-init-invalid-yield.src.js | 27 + ...lass-static-init-scope-lex-close.result.js | 1167 +++ ...s-class-static-init-scope-lex-close.src.js | 27 + ...ss-static-init-scope-lex-derived.result.js | 765 ++ ...class-static-init-scope-lex-derived.src.js | 23 + ...class-static-init-scope-lex-open.result.js | 2128 ++++ ...ts-class-static-init-scope-lex-open.src.js | 31 + ...-class-static-init-scope-private.result.js | 985 ++ ...nts-class-static-init-scope-private.src.js | 25 + ...lass-static-init-scope-var-close.result.js | 1167 +++ ...s-class-static-init-scope-var-close.src.js | 27 + ...ss-static-init-scope-var-derived.result.js | 930 ++ ...class-static-init-scope-var-derived.src.js | 24 + ...class-static-init-scope-var-open.result.js | 2128 ++++ ...ts-class-static-init-scope-var-open.src.js | 31 + ...ments-class-static-init-sequence.result.js | 3104 ++++++ ...atements-class-static-init-sequence.src.js | 38 + ...tic-init-statement-list-optional.result.js | 221 + ...static-init-statement-list-optional.src.js | 18 + ...class-static-init-super-property.result.js | 1273 +++ ...ts-class-static-init-super-property.src.js | 24 + ...tatic-init-await-binding-invalid.result.js | 6 + ...t-static-init-await-binding-invalid.src.js | 26 + ...-init-await-binding-valid.module-result.js | 6 + ...-static-init-await-binding-valid.result.js | 588 ++ ...nst-static-init-await-binding-valid.src.js | 18 + ...-continue-static-init-with-label.result.js | 6 + ...nts-continue-static-init-with-label.src.js | 28 + ...ntinue-static-init-without-label.result.js | 6 + ...-continue-static-init-without-label.src.js | 28 + ...tatic-init-await-binding-invalid.result.js | 6 + ...n-static-init-await-binding-invalid.src.js | 27 + ...-init-await-binding-valid.module-result.js | 6 + ...-static-init-await-binding-valid.result.js | 589 ++ ...ion-static-init-await-binding-valid.src.js | 18 + ...abeled-static-init-invalid-await.result.js | 6 + ...s-labeled-static-init-invalid-await.src.js | 25 + ...tatic-init-await-binding-invalid.result.js | 6 + ...t-static-init-await-binding-invalid.src.js | 26 + ...-init-await-binding-valid.module-result.js | 6 + ...-static-init-await-binding-valid.result.js | 534 + ...let-static-init-await-binding-valid.src.js | 18 + ...tatic-init-await-binding-invalid.result.js | 6 + ...y-static-init-await-binding-invalid.src.js | 26 + ...-init-await-binding-valid.module-result.js | 6 + ...-static-init-await-binding-valid.result.js | 675 ++ ...try-static-init-await-binding-valid.src.js | 18 + ...lem-id-static-init-await-invalid.result.js | 6 + ...n-elem-id-static-init-await-invalid.src.js | 26 + ...d-static-init-await-valid.module-result.js | 6 + ...-elem-id-static-init-await-valid.result.js | 660 ++ ...trn-elem-id-static-init-await-valid.src.js | 18 + ...lem-id-static-init-await-invalid.result.js | 6 + ...n-elem-id-static-init-await-invalid.src.js | 26 + ...d-static-init-await-valid.module-result.js | 6 + ...-elem-id-static-init-await-valid.result.js | 699 ++ ...trn-elem-id-static-init-await-valid.src.js | 18 + ...tatic-init-await-binding-invalid.result.js | 6 + ...e-static-init-await-binding-invalid.src.js | 26 + ...-init-await-binding-valid.module-result.js | 6 + ...-static-init-await-binding-valid.result.js | 534 + ...ble-static-init-await-binding-valid.src.js | 18 + 146 files changed, 56041 insertions(+) create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-binding.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-binding.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-reference.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-reference.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-binding.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-binding.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-ident-name-prop-name-literal-await-static-init.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-ident-name-prop-name-literal-await-static-init.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-invalid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-invalid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/identifier-resolution-static-init-invalid-await.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/identifier-resolution-static-init-invalid-await.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-break-static-init-without-label.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-break-static-init-without-label.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-abrupt.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-abrupt.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-functions.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-functions.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-methods.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-methods.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-invalid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-invalid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-new-target.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-new-target.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-this.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-this.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-arguments.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-arguments.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-await.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-await.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-label-dup.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-label-dup.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-dup.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-dup.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-var.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-var.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-return.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-return.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-super-call.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-super-call.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-break-target.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-break-target.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-continue-target.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-continue-target.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-yield.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-yield.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-close.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-close.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-derived.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-derived.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-open.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-open.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-private.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-private.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-close.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-close.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-derived.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-derived.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-open.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-open.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-sequence.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-sequence.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-statement-list-optional.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-statement-list-optional.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-super-property.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-super-property.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-invalid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-invalid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-with-label.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-with-label.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-without-label.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-without-label.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-invalid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-invalid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-labeled-static-init-invalid-await.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-labeled-static-init-invalid-await.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-invalid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-invalid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-invalid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-invalid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-invalid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-invalid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-invalid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-invalid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-invalid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-invalid.src.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.module-result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.result.js create mode 100644 tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.src.js diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-binding.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-binding.result.js new file mode 100644 index 00000000..2f3a7714 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-binding.result.js @@ -0,0 +1,6 @@ +export default { + "index": 411, + "lineNumber": 16, + "column": 6, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-binding.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-binding.src.js new file mode 100644 index 00000000..c83c3a3c --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-binding.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is disallowed in the BindingIdentifier position +features: [class-static-block] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class C { + static { + (await => 0); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-reference.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-reference.result.js new file mode 100644 index 00000000..28a02b6f --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-reference.result.js @@ -0,0 +1,6 @@ +export default { + "index": 418, + "lineNumber": 16, + "column": 11, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-reference.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-reference.src.js new file mode 100644 index 00000000..8b20af7e --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-arrow-function-static-init-await-reference.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is disallowed in the IdentifierReference position +features: [class-static-block] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class C { + static { + ((x = await) => 0); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-binding.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-binding.result.js new file mode 100644 index 00000000..e4ec52ea --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-binding.result.js @@ -0,0 +1,6 @@ +export default { + "index": 562, + "lineNumber": 21, + "column": 12, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-binding.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-binding.src.js new file mode 100644 index 00000000..c99b04c5 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-binding.src.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is disallowed as a BindingIdentifier +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class C { + static { + (class await {}); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.module-result.js new file mode 100644 index 00000000..ba903f96 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 499, + "lineNumber": 14, + "column": 5, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.result.js new file mode 100644 index 00000000..2a724719 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.result.js @@ -0,0 +1,1951 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 495, + 759 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 495, + 509 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 499, + 508 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 499, + 504 + ], + "name": "await" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 507, + 508 + ], + "value": 0, + "raw": "0" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 510, + 534 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 514, + 523 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 514, + 523 + ], + "name": "fromParam" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 525, + 533 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 525, + 533 + ], + "name": "fromBody" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 536, + 664 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 542, + 543 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 544, + 664 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 548, + 662 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 7 + } + }, + "range": [ + 561, + 658 + ], + "expression": { + "type": "NewExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 561, + 657 + ], + "callee": { + "type": "ClassExpression", + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 566, + 656 + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 572, + 656 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 580, + 650 + ], + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 17 + } + }, + "range": [ + 580, + 591 + ], + "name": "constructor" + }, + "kind": "constructor", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 591, + 650 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 39 + } + }, + "range": [ + 592, + 613 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 19 + } + }, + "range": [ + 592, + 593 + ], + "name": "x" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 39 + } + }, + "range": [ + 596, + 613 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 596, + 605 + ], + "name": "fromParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 34 + }, + "end": { + "line": 20, + "column": 39 + } + }, + "range": [ + 608, + 613 + ], + "name": "await" + } + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 20, + "column": 41 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 615, + 650 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "range": [ + 625, + 642 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 625, + 641 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 625, + 633 + ], + "name": "fromBody" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 636, + 641 + ], + "name": "await" + } + } + } + ] + } + } + } + ] + } + }, + "arguments": [] + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 49 + } + }, + "range": [ + 666, + 715 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 48 + } + }, + "range": [ + 666, + 714 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 666, + 682 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 666, + 672 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 673, + 682 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "range": [ + 683, + 692 + ], + "name": "fromParam" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "range": [ + 694, + 695 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 47 + } + }, + "range": [ + 697, + 713 + ], + "value": "from parameter", + "raw": "'from parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 716, + 759 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 42 + } + }, + "range": [ + 716, + 758 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 716, + 732 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + }, + "range": [ + 716, + 722 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 723, + 732 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "range": [ + 733, + 741 + ], + "name": "fromBody" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 28 + } + }, + "range": [ + 743, + 744 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 28, + "column": 30 + }, + "end": { + "line": 28, + "column": 41 + } + }, + "range": [ + 746, + 757 + ], + "value": "from body", + "raw": "'from body'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + }, + "range": [ + 495, + 498 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 499, + 504 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + }, + "range": [ + 505, + 506 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 507, + 508 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 508, + 509 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 510, + 513 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 514, + 523 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + }, + "range": [ + 523, + 524 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 525, + 533 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 533, + 534 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 536, + 541 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 544, + 545 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 548, + 554 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 555, + 556 + ] + }, + { + "type": "Keyword", + "value": "new", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 7 + } + }, + "range": [ + 561, + 564 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "range": [ + 565, + 566 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 14 + } + }, + "range": [ + 566, + 571 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 16 + } + }, + "range": [ + 572, + 573 + ] + }, + { + "type": "Identifier", + "value": "constructor", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 17 + } + }, + "range": [ + 580, + 591 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 18 + } + }, + "range": [ + 591, + 592 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 19 + } + }, + "range": [ + 592, + 593 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 20 + }, + "end": { + "line": 20, + "column": 21 + } + }, + "range": [ + 594, + 595 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 596, + 605 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 32 + }, + "end": { + "line": 20, + "column": 33 + } + }, + "range": [ + 606, + 607 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 20, + "column": 34 + }, + "end": { + "line": 20, + "column": 39 + } + }, + "range": [ + 608, + 613 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 20, + "column": 39 + }, + "end": { + "line": 20, + "column": 40 + } + }, + "range": [ + 613, + 614 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 20, + "column": 41 + }, + "end": { + "line": 20, + "column": 42 + } + }, + "range": [ + 615, + 616 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 625, + 633 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 18 + } + }, + "range": [ + 634, + 635 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 636, + 641 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "range": [ + 641, + 642 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 649, + 650 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 655, + 656 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 656, + 657 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + }, + "range": [ + 657, + 658 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 661, + 662 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 663, + 664 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 666, + 672 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 672, + 673 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 673, + 682 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "range": [ + 682, + 683 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "range": [ + 683, + 692 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "range": [ + 692, + 693 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "range": [ + 694, + 695 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "range": [ + 695, + 696 + ] + }, + { + "type": "String", + "value": "'from parameter'", + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 47 + } + }, + "range": [ + 697, + 713 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 47 + }, + "end": { + "line": 27, + "column": 48 + } + }, + "range": [ + 713, + 714 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 27, + "column": 48 + }, + "end": { + "line": 27, + "column": 49 + } + }, + "range": [ + 714, + 715 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + }, + "range": [ + 716, + 722 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 28, + "column": 6 + }, + "end": { + "line": 28, + "column": 7 + } + }, + "range": [ + 722, + 723 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 723, + 732 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 28, + "column": 16 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "range": [ + 732, + 733 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "range": [ + 733, + 741 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 26 + } + }, + "range": [ + 741, + 742 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 28 + } + }, + "range": [ + 743, + 744 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 28, + "column": 28 + }, + "end": { + "line": 28, + "column": 29 + } + }, + "range": [ + 744, + 745 + ] + }, + { + "type": "String", + "value": "'from body'", + "loc": { + "start": { + "line": 28, + "column": 30 + }, + "end": { + "line": 28, + "column": 41 + } + }, + "range": [ + 746, + 757 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 28, + "column": 41 + }, + "end": { + "line": 28, + "column": 42 + } + }, + "range": [ + 757, + 758 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 28, + "column": 42 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 758, + 759 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.src.js new file mode 100644 index 00000000..f27128a2 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-class-static-init-await-reference.src.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as a IdentifierReference in method parameter lists +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + new (class { + constructor(x = fromParam = await) { + fromBody = await; + } + }); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.module-result.js new file mode 100644 index 00000000..9abb602e --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 533, + "lineNumber": 16, + "column": 15, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.result.js new file mode 100644 index 00000000..3300a36a --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.result.js @@ -0,0 +1,495 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 556 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 556 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 504, + 505 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 506, + 556 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 510, + 554 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 523, + 550 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 524, + 548 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 533, + 538 + ], + "name": "await" + }, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 20 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 539, + 544 + ], + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 546, + 548 + ], + "body": [] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 498, + 503 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 504, + 505 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 506, + 507 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 510, + 516 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 523, + 524 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 13 + } + }, + "range": [ + 524, + 532 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 533, + 538 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 20 + } + }, + "range": [ + 538, + 539 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 20 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 539, + 544 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "range": [ + 544, + 545 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 546, + 547 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 547, + 548 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 30 + } + }, + "range": [ + 548, + 549 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 30 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 549, + 550 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 553, + 554 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 555, + 556 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.src.js new file mode 100644 index 00000000..cc8d0e09 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-binding.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an IdentifierReference within function expressions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (function await(await) {}); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.module-result.js new file mode 100644 index 00000000..afe64259 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 502, + "lineNumber": 14, + "column": 5, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.result.js new file mode 100644 index 00000000..38532ae3 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.result.js @@ -0,0 +1,1840 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 26, + "column": 43 + } + }, + "range": [ + 498, + 734 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 498, + 512 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 502, + 511 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 502, + 507 + ], + "name": "await" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 510, + 511 + ], + "value": 0, + "raw": "0" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 513, + 537 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 517, + 526 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 517, + 526 + ], + "name": "fromParam" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 528, + 536 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 528, + 536 + ], + "name": "fromBody" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "range": [ + 539, + 639 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 545, + 546 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "range": [ + 547, + 639 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 551, + 637 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 21, + "column": 9 + } + }, + "range": [ + 564, + 633 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 21, + "column": 8 + } + }, + "range": [ + 564, + 632 + ], + "callee": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 21, + "column": 5 + } + }, + "range": [ + 565, + 629 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 36 + } + }, + "range": [ + 575, + 596 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 16 + } + }, + "range": [ + 575, + 576 + ], + "name": "x" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 36 + } + }, + "range": [ + 579, + 596 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 28 + } + }, + "range": [ + 579, + 588 + ], + "name": "fromParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 31 + }, + "end": { + "line": 19, + "column": 36 + } + }, + "range": [ + 591, + 596 + ], + "name": "await" + } + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 19, + "column": 38 + }, + "end": { + "line": 21, + "column": 5 + } + }, + "range": [ + 598, + 629 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 23 + } + }, + "range": [ + 606, + 623 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 22 + } + }, + "range": [ + 606, + 622 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 14 + } + }, + "range": [ + 606, + 614 + ], + "name": "fromBody" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 22 + } + }, + "range": [ + 617, + 622 + ], + "name": "await" + } + } + } + ] + } + }, + "arguments": [], + "optional": false + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 49 + } + }, + "range": [ + 641, + 690 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 641, + 689 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "range": [ + 641, + 657 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 6 + } + }, + "range": [ + 641, + 647 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "range": [ + 648, + 657 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "range": [ + 658, + 667 + ], + "name": "fromParam" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 29 + } + }, + "range": [ + 669, + 670 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 47 + } + }, + "range": [ + 672, + 688 + ], + "value": "from parameter", + "raw": "'from parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 43 + } + }, + "range": [ + 691, + 734 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 42 + } + }, + "range": [ + 691, + 733 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "range": [ + 691, + 707 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 6 + } + }, + "range": [ + 691, + 697 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "range": [ + 698, + 707 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "range": [ + 708, + 716 + ], + "name": "fromBody" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 26, + "column": 27 + }, + "end": { + "line": 26, + "column": 28 + } + }, + "range": [ + 718, + 719 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 26, + "column": 30 + }, + "end": { + "line": 26, + "column": 41 + } + }, + "range": [ + 721, + 732 + ], + "value": "from body", + "raw": "'from body'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + }, + "range": [ + 498, + 501 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 502, + 507 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + }, + "range": [ + 508, + 509 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 510, + 511 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 511, + 512 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 513, + 516 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 517, + 526 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + }, + "range": [ + 526, + 527 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 528, + 536 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 536, + 537 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 539, + 544 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 545, + 546 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 547, + 548 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 551, + 557 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 558, + 559 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + }, + "range": [ + 564, + 565 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 13 + } + }, + "range": [ + 565, + 573 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "range": [ + 574, + 575 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 16 + } + }, + "range": [ + 575, + 576 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + }, + "range": [ + 577, + 578 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 28 + } + }, + "range": [ + 579, + 588 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 19, + "column": 29 + }, + "end": { + "line": 19, + "column": 30 + } + }, + "range": [ + 589, + 590 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 19, + "column": 31 + }, + "end": { + "line": 19, + "column": 36 + } + }, + "range": [ + 591, + 596 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 19, + "column": 36 + }, + "end": { + "line": 19, + "column": 37 + } + }, + "range": [ + 596, + 597 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 38 + }, + "end": { + "line": 19, + "column": 39 + } + }, + "range": [ + 598, + 599 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 14 + } + }, + "range": [ + 606, + 614 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 16 + } + }, + "range": [ + 615, + 616 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 22 + } + }, + "range": [ + 617, + 622 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 23 + } + }, + "range": [ + 622, + 623 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 5 + } + }, + "range": [ + 628, + 629 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 6 + } + }, + "range": [ + 629, + 630 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 7 + } + }, + "range": [ + 630, + 631 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + }, + "range": [ + 631, + 632 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + }, + "range": [ + 632, + 633 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 636, + 637 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "range": [ + 638, + 639 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 6 + } + }, + "range": [ + 641, + 647 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 7 + } + }, + "range": [ + 647, + 648 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "range": [ + 648, + 657 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 17 + } + }, + "range": [ + 657, + 658 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "range": [ + 658, + 667 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "range": [ + 667, + 668 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 29 + } + }, + "range": [ + 669, + 670 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 25, + "column": 29 + }, + "end": { + "line": 25, + "column": 30 + } + }, + "range": [ + 670, + 671 + ] + }, + { + "type": "String", + "value": "'from parameter'", + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 47 + } + }, + "range": [ + 672, + 688 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 25, + "column": 47 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 688, + 689 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 25, + "column": 48 + }, + "end": { + "line": 25, + "column": 49 + } + }, + "range": [ + 689, + 690 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 6 + } + }, + "range": [ + 691, + 697 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 7 + } + }, + "range": [ + 697, + 698 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "range": [ + 698, + 707 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 26, + "column": 16 + }, + "end": { + "line": 26, + "column": 17 + } + }, + "range": [ + 707, + 708 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "range": [ + 708, + 716 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 26, + "column": 25 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "range": [ + 716, + 717 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 26, + "column": 27 + }, + "end": { + "line": 26, + "column": 28 + } + }, + "range": [ + 718, + 719 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 29 + } + }, + "range": [ + 719, + 720 + ] + }, + { + "type": "String", + "value": "'from body'", + "loc": { + "start": { + "line": 26, + "column": 30 + }, + "end": { + "line": 26, + "column": 41 + } + }, + "range": [ + 721, + 732 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 26, + "column": 41 + }, + "end": { + "line": 26, + "column": 42 + } + }, + "range": [ + 732, + 733 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 26, + "column": 42 + }, + "end": { + "line": 26, + "column": 43 + } + }, + "range": [ + 733, + 734 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.src.js new file mode 100644 index 00000000..50a55c99 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-function-static-init-await-reference.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an IdentifierReference within function expressions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + (function (x = fromParam = await) { + fromBody = await; + })(); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.module-result.js new file mode 100644 index 00000000..33ac0321 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 536, + "lineNumber": 16, + "column": 17, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.result.js new file mode 100644 index 00000000..af14e47e --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.result.js @@ -0,0 +1,513 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 499, + 560 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 499, + 560 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 505, + 506 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 507, + 560 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 511, + 558 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 34 + } + }, + "range": [ + 524, + 554 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 525, + 552 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 21 + } + }, + "range": [ + 536, + 541 + ], + "name": "await" + }, + "expression": false, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 543, + 548 + ], + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 30 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 550, + 552 + ], + "body": [] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 499, + 504 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 505, + 506 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 507, + 508 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 511, + 517 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 518, + 519 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 524, + 525 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 13 + } + }, + "range": [ + 525, + 533 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 15 + } + }, + "range": [ + 534, + 535 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 21 + } + }, + "range": [ + 536, + 541 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 543, + 548 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 548, + 549 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 30 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 550, + 551 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 551, + 552 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 32 + }, + "end": { + "line": 16, + "column": 33 + } + }, + "range": [ + 552, + 553 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 33 + }, + "end": { + "line": 16, + "column": 34 + } + }, + "range": [ + 553, + 554 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 557, + 558 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 559, + 560 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.src.js new file mode 100644 index 00000000..09b52e8e --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-binding.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an Identifier within generator function expressions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (function * await (await) {}); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.module-result.js new file mode 100644 index 00000000..eacf1c38 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 503, + "lineNumber": 14, + "column": 5, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.result.js new file mode 100644 index 00000000..efd81d8f --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.result.js @@ -0,0 +1,1986 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 26, + "column": 43 + } + }, + "range": [ + 499, + 744 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 499, + 513 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 503, + 512 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 503, + 508 + ], + "name": "await" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 511, + 512 + ], + "value": 0, + "raw": "0" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 514, + 538 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 518, + 527 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 518, + 527 + ], + "name": "fromParam" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 529, + 537 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 529, + 537 + ], + "name": "fromBody" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "range": [ + 540, + 649 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 546, + 547 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "range": [ + 548, + 649 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 552, + 647 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 565, + 643 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 21, + "column": 15 + } + }, + "range": [ + 565, + 642 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 21, + "column": 13 + } + }, + "range": [ + 565, + 640 + ], + "object": { + "type": "CallExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 21, + "column": 8 + } + }, + "range": [ + 565, + 635 + ], + "callee": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 21, + "column": 5 + } + }, + "range": [ + 566, + 632 + ], + "id": null, + "expression": false, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 38 + } + }, + "range": [ + 578, + 599 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + }, + "range": [ + 578, + 579 + ], + "name": "x" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 38 + } + }, + "range": [ + 582, + 599 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 30 + } + }, + "range": [ + 582, + 591 + ], + "name": "fromParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 33 + }, + "end": { + "line": 19, + "column": 38 + } + }, + "range": [ + 594, + 599 + ], + "name": "await" + } + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 19, + "column": 40 + }, + "end": { + "line": 21, + "column": 5 + } + }, + "range": [ + 601, + 632 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 23 + } + }, + "range": [ + 609, + 626 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 22 + } + }, + "range": [ + 609, + 625 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 14 + } + }, + "range": [ + 609, + 617 + ], + "name": "fromBody" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 22 + } + }, + "range": [ + 620, + 625 + ], + "name": "await" + } + } + } + ] + } + }, + "arguments": [], + "optional": false + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 13 + } + }, + "range": [ + 636, + 640 + ], + "name": "next" + }, + "computed": false, + "optional": false + }, + "arguments": [], + "optional": false + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 49 + } + }, + "range": [ + 651, + 700 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 651, + 699 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "range": [ + 651, + 667 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 6 + } + }, + "range": [ + 651, + 657 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "range": [ + 658, + 667 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "range": [ + 668, + 677 + ], + "name": "fromParam" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 29 + } + }, + "range": [ + 679, + 680 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 47 + } + }, + "range": [ + 682, + 698 + ], + "value": "from parameter", + "raw": "'from parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 43 + } + }, + "range": [ + 701, + 744 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 42 + } + }, + "range": [ + 701, + 743 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "range": [ + 701, + 717 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 6 + } + }, + "range": [ + 701, + 707 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "range": [ + 708, + 717 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "range": [ + 718, + 726 + ], + "name": "fromBody" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 26, + "column": 27 + }, + "end": { + "line": 26, + "column": 28 + } + }, + "range": [ + 728, + 729 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 26, + "column": 30 + }, + "end": { + "line": 26, + "column": 41 + } + }, + "range": [ + 731, + 742 + ], + "value": "from body", + "raw": "'from body'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + }, + "range": [ + 499, + 502 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 503, + 508 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + }, + "range": [ + 509, + 510 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 511, + 512 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 512, + 513 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 514, + 517 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 518, + 527 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + }, + "range": [ + 527, + 528 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 529, + 537 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 537, + 538 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 540, + 545 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 546, + 547 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 548, + 549 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 552, + 558 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 559, + 560 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + }, + "range": [ + 565, + 566 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 13 + } + }, + "range": [ + 566, + 574 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "range": [ + 575, + 576 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 17 + } + }, + "range": [ + 577, + 578 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + }, + "range": [ + 578, + 579 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 20 + } + }, + "range": [ + 580, + 581 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 30 + } + }, + "range": [ + 582, + 591 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 19, + "column": 31 + }, + "end": { + "line": 19, + "column": 32 + } + }, + "range": [ + 592, + 593 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 19, + "column": 33 + }, + "end": { + "line": 19, + "column": 38 + } + }, + "range": [ + 594, + 599 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 19, + "column": 38 + }, + "end": { + "line": 19, + "column": 39 + } + }, + "range": [ + 599, + 600 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 40 + }, + "end": { + "line": 19, + "column": 41 + } + }, + "range": [ + 601, + 602 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 14 + } + }, + "range": [ + 609, + 617 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 16 + } + }, + "range": [ + 618, + 619 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 22 + } + }, + "range": [ + 620, + 625 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 23 + } + }, + "range": [ + 625, + 626 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 5 + } + }, + "range": [ + 631, + 632 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 6 + } + }, + "range": [ + 632, + 633 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 7 + } + }, + "range": [ + 633, + 634 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + }, + "range": [ + 634, + 635 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + }, + "range": [ + 635, + 636 + ] + }, + { + "type": "Identifier", + "value": "next", + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 13 + } + }, + "range": [ + 636, + 640 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 14 + } + }, + "range": [ + 640, + 641 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 15 + } + }, + "range": [ + 641, + 642 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 21, + "column": 15 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 642, + 643 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 646, + 647 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "range": [ + 648, + 649 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 6 + } + }, + "range": [ + 651, + 657 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 7 + } + }, + "range": [ + 657, + 658 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "range": [ + 658, + 667 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 17 + } + }, + "range": [ + 667, + 668 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "range": [ + 668, + 677 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "range": [ + 677, + 678 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 29 + } + }, + "range": [ + 679, + 680 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 25, + "column": 29 + }, + "end": { + "line": 25, + "column": 30 + } + }, + "range": [ + 680, + 681 + ] + }, + { + "type": "String", + "value": "'from parameter'", + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 47 + } + }, + "range": [ + 682, + 698 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 25, + "column": 47 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 698, + 699 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 25, + "column": 48 + }, + "end": { + "line": 25, + "column": 49 + } + }, + "range": [ + 699, + 700 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 6 + } + }, + "range": [ + 701, + 707 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 7 + } + }, + "range": [ + 707, + 708 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "range": [ + 708, + 717 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 26, + "column": 16 + }, + "end": { + "line": 26, + "column": 17 + } + }, + "range": [ + 717, + 718 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "range": [ + 718, + 726 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 26, + "column": 25 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "range": [ + 726, + 727 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 26, + "column": 27 + }, + "end": { + "line": 26, + "column": 28 + } + }, + "range": [ + 728, + 729 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 29 + } + }, + "range": [ + 729, + 730 + ] + }, + { + "type": "String", + "value": "'from body'", + "loc": { + "start": { + "line": 26, + "column": 30 + }, + "end": { + "line": 26, + "column": 41 + } + }, + "range": [ + 731, + 742 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 26, + "column": 41 + }, + "end": { + "line": 26, + "column": 42 + } + }, + "range": [ + 742, + 743 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 26, + "column": 42 + }, + "end": { + "line": 26, + "column": 43 + } + }, + "range": [ + 743, + 744 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.src.js new file mode 100644 index 00000000..952fd47c --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-generators-static-init-await-reference.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an Identifier within generator function expressions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + (function * (x = fromParam = await) { + fromBody = await; + })().next(); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-ident-name-prop-name-literal-await-static-init.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-ident-name-prop-name-literal-await-static-init.result.js new file mode 100644 index 00000000..d215f4b4 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-ident-name-prop-name-literal-await-static-init.result.js @@ -0,0 +1,460 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 616, + 662 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 616, + 662 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 622, + 623 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 624, + 662 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + }, + "range": [ + 628, + 660 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 19 + } + }, + "range": [ + 641, + 656 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 17 + } + }, + "range": [ + 642, + 654 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "range": [ + 644, + 652 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 12 + } + }, + "range": [ + 644, + 649 + ], + "name": "await" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "range": [ + 651, + 652 + ], + "value": 0, + "raw": "0" + }, + "kind": "init" + } + ] + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 616, + 621 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 622, + 623 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 624, + 625 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 628, + 634 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 635, + 636 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + }, + "range": [ + 641, + 642 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 6 + } + }, + "range": [ + 642, + 643 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 12 + } + }, + "range": [ + 644, + 649 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 13 + } + }, + "range": [ + 649, + 650 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "range": [ + 651, + 652 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 17 + } + }, + "range": [ + 653, + 654 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + }, + "range": [ + 654, + 655 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 19 + } + }, + "range": [ + 655, + 656 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + }, + "range": [ + 659, + 660 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 661, + 662 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-ident-name-prop-name-literal-await-static-init.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-ident-name-prop-name-literal-await-static-init.src.js new file mode 100644 index 00000000..ab01dfc8 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-ident-name-prop-name-literal-await-static-init.src.js @@ -0,0 +1,22 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The restriction on `await` does not apply to IdentifierName +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +features: [class-static-block] +---*/ + +class C { + static { + ({ await: 0 }); + } +} + diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-invalid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-invalid.result.js new file mode 100644 index 00000000..b3a81345 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-invalid.result.js @@ -0,0 +1,6 @@ +export default { + "index": 723, + "lineNumber": 23, + "column": 8, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-invalid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-invalid.src.js new file mode 100644 index 00000000..2f693b46 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-invalid.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: IdentifierReference may not be `await` within class static blocks +info: | + IdentifierReference : Identifier + + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "arguments" or "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + ({ await }); + } +} + diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.module-result.js new file mode 100644 index 00000000..983d6a10 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 531, + "lineNumber": 16, + "column": 15, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.result.js new file mode 100644 index 00000000..3013d6b7 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.result.js @@ -0,0 +1,535 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 496, + 547 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 496, + 547 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 502, + 503 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 504, + 547 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 508, + 545 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 521, + 541 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 522, + 539 + ], + "id": null, + "expression": true, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 21 + } + }, + "range": [ + 529, + 538 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 531, + 536 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 531, + 536 + ], + "name": "await" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 531, + 536 + ], + "name": "await" + } + } + ] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 496, + 501 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 502, + 503 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 504, + 505 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 508, + 514 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 515, + 516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 521, + 522 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 523, + 524 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 525, + 527 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 528, + 529 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 13 + } + }, + "range": [ + 529, + 530 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 531, + 536 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 20 + }, + "end": { + "line": 16, + "column": 21 + } + }, + "range": [ + 537, + 538 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 538, + 539 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 539, + 540 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 540, + 541 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 544, + 545 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 546, + 547 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.src.js new file mode 100644 index 00000000..868bb984 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-identifier-shorthand-static-init-await-valid.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within the body of arrow functions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => ({ await })); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.module-result.js new file mode 100644 index 00000000..ebb1186f --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 537, + "lineNumber": 16, + "column": 20, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.result.js new file mode 100644 index 00000000..a01ab120 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.result.js @@ -0,0 +1,572 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 497, + 555 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 497, + 555 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 503, + 504 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 505, + 555 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 509, + 553 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 522, + 549 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 523, + 547 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 524, + 546 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 528, + 536 + ], + "name": "accessor" + }, + "kind": "set", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 536, + 546 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 537, + 542 + ], + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 544, + 546 + ], + "body": [] + } + } + } + ] + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 497, + 502 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 503, + 504 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 505, + 506 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 509, + 515 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 523, + 524 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 524, + 527 + ] + }, + { + "type": "Identifier", + "value": "accessor", + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 528, + 536 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 536, + 537 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 537, + 542 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 544, + 545 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 545, + 546 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 546, + 547 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 30 + } + }, + "range": [ + 547, + 548 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 30 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 548, + 549 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 552, + 553 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 554, + 555 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.src.js new file mode 100644 index 00000000..8eeda7fc --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-accessor.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within the body of accessor methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + ({set accessor(await) {}}); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.module-result.js new file mode 100644 index 00000000..c6d6ae09 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 543, + "lineNumber": 16, + "column": 15, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.result.js new file mode 100644 index 00000000..1d4d82f7 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.result.js @@ -0,0 +1,572 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 508, + 561 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 508, + 561 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 514, + 515 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 516, + 561 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 520, + 559 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "range": [ + 533, + 555 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 534, + 553 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 535, + 552 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + }, + "range": [ + 536, + 542 + ], + "name": "method" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 542, + 552 + ], + "id": null, + "expression": false, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 543, + 548 + ], + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 550, + 552 + ], + "body": [] + } + } + } + ] + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 508, + 513 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 514, + 515 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 520, + 526 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 527, + 528 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 533, + 534 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 534, + 535 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 535, + 536 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 13 + } + }, + "range": [ + 536, + 542 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 14 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 543, + 548 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 20 + } + }, + "range": [ + 548, + 549 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 550, + 551 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 551, + 552 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 552, + 553 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 553, + 554 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "range": [ + 554, + 555 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 558, + 559 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 560, + 561 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.src.js new file mode 100644 index 00000000..33e5f182 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-generator.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within the parameter list of generator methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + ({*method(await) {}}); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.module-result.js new file mode 100644 index 00000000..abef7f63 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 532, + "lineNumber": 16, + "column": 14, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.result.js new file mode 100644 index 00000000..8d5f7dfb --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.result.js @@ -0,0 +1,554 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 550 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 550 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 504, + 505 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 506, + 550 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 510, + 548 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 523, + 544 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 524, + 542 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 525, + 541 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 525, + 531 + ], + "name": "method" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 531, + 541 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 532, + 537 + ], + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 20 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 539, + 541 + ], + "body": [] + } + } + } + ] + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 498, + 503 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 504, + 505 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 506, + 507 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 510, + 516 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 523, + 524 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 524, + 525 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 525, + 531 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 13 + } + }, + "range": [ + 531, + 532 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 532, + 537 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 537, + 538 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 20 + }, + "end": { + "line": 16, + "column": 21 + } + }, + "range": [ + 539, + 540 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 540, + 541 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 541, + 542 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 543, + 544 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 547, + 548 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 549, + 550 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.src.js new file mode 100644 index 00000000..4c548f4b --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-binding-normal.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within the parameter list of methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + ({method(await) {}}); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.module-result.js new file mode 100644 index 00000000..e43b8746 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 489, + "lineNumber": 14, + "column": 5, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.result.js new file mode 100644 index 00000000..eef5172b --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.result.js @@ -0,0 +1,2042 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 485, + 761 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 485, + 499 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 489, + 498 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 489, + 494 + ], + "name": "await" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 497, + 498 + ], + "value": 0, + "raw": "0" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 500, + 524 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 504, + 513 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 504, + 513 + ], + "name": "fromParam" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 515, + 523 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 515, + 523 + ], + "name": "fromBody" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 526, + 666 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 532, + 533 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 534, + 666 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 538, + 664 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 28 + } + }, + "range": [ + 551, + 660 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "range": [ + 551, + 659 + ], + "operator": "=", + "left": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 15 + } + }, + "range": [ + 551, + 647 + ], + "object": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 552, + 637 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 560, + 631 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 18 + } + }, + "range": [ + 564, + 572 + ], + "name": "accessor" + }, + "kind": "set", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 572, + 631 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 40 + } + }, + "range": [ + 573, + 594 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 20 + } + }, + "range": [ + 573, + 574 + ], + "name": "x" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 20, + "column": 23 + }, + "end": { + "line": 20, + "column": 40 + } + }, + "range": [ + 577, + 594 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 23 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 577, + 586 + ], + "name": "fromParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 35 + }, + "end": { + "line": 20, + "column": 40 + } + }, + "range": [ + 589, + 594 + ], + "name": "await" + } + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 20, + "column": 42 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 596, + 631 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "range": [ + 606, + 623 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 606, + 622 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 606, + 614 + ], + "name": "fromBody" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 617, + 622 + ], + "name": "await" + } + } + } + ] + } + } + } + ] + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 15 + } + }, + "range": [ + 639, + 647 + ], + "name": "accessor" + }, + "computed": false, + "optional": false + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 18 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "range": [ + 650, + 659 + ], + "name": "undefined" + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 49 + } + }, + "range": [ + 668, + 717 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 48 + } + }, + "range": [ + 668, + 716 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 668, + 684 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 668, + 674 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 675, + 684 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "range": [ + 685, + 694 + ], + "name": "fromParam" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "range": [ + 696, + 697 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 47 + } + }, + "range": [ + 699, + 715 + ], + "value": "from parameter", + "raw": "'from parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 718, + 761 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 42 + } + }, + "range": [ + 718, + 760 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 718, + 734 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + }, + "range": [ + 718, + 724 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 725, + 734 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "range": [ + 735, + 743 + ], + "name": "fromBody" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 28 + } + }, + "range": [ + 745, + 746 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 28, + "column": 30 + }, + "end": { + "line": 28, + "column": 41 + } + }, + "range": [ + 748, + 759 + ], + "value": "from body", + "raw": "'from body'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + }, + "range": [ + 485, + 488 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 489, + 494 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + }, + "range": [ + 495, + 496 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 497, + 498 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 500, + 503 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 504, + 513 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + }, + "range": [ + 513, + 514 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 515, + 523 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 523, + 524 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 526, + 531 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 532, + 533 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 534, + 535 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 538, + 544 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 545, + 546 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + }, + "range": [ + 551, + 552 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 6 + } + }, + "range": [ + 552, + 553 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 9 + } + }, + "range": [ + 560, + 563 + ] + }, + { + "type": "Identifier", + "value": "accessor", + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 18 + } + }, + "range": [ + 564, + 572 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 19 + } + }, + "range": [ + 572, + 573 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 20 + } + }, + "range": [ + 573, + 574 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 22 + } + }, + "range": [ + 575, + 576 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 20, + "column": 23 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 577, + 586 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 20, + "column": 34 + } + }, + "range": [ + 587, + 588 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 20, + "column": 35 + }, + "end": { + "line": 20, + "column": 40 + } + }, + "range": [ + 589, + 594 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 20, + "column": 40 + }, + "end": { + "line": 20, + "column": 41 + } + }, + "range": [ + 594, + 595 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 20, + "column": 42 + }, + "end": { + "line": 20, + "column": 43 + } + }, + "range": [ + 596, + 597 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 606, + 614 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 18 + } + }, + "range": [ + 615, + 616 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 617, + 622 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "range": [ + 622, + 623 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 630, + 631 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 636, + 637 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 637, + 638 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + }, + "range": [ + 638, + 639 + ] + }, + { + "type": "Identifier", + "value": "accessor", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 15 + } + }, + "range": [ + 639, + 647 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "range": [ + 648, + 649 + ] + }, + { + "type": "Identifier", + "value": "undefined", + "loc": { + "start": { + "line": 23, + "column": 18 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "range": [ + 650, + 659 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 28 + } + }, + "range": [ + 659, + 660 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 663, + 664 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 665, + 666 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 668, + 674 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 674, + 675 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 675, + 684 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "range": [ + 684, + 685 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "range": [ + 685, + 694 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "range": [ + 694, + 695 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "range": [ + 696, + 697 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "range": [ + 697, + 698 + ] + }, + { + "type": "String", + "value": "'from parameter'", + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 47 + } + }, + "range": [ + 699, + 715 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 47 + }, + "end": { + "line": 27, + "column": 48 + } + }, + "range": [ + 715, + 716 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 27, + "column": 48 + }, + "end": { + "line": 27, + "column": 49 + } + }, + "range": [ + 716, + 717 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + }, + "range": [ + 718, + 724 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 28, + "column": 6 + }, + "end": { + "line": 28, + "column": 7 + } + }, + "range": [ + 724, + 725 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 725, + 734 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 28, + "column": 16 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "range": [ + 734, + 735 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "range": [ + 735, + 743 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 26 + } + }, + "range": [ + 743, + 744 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 28 + } + }, + "range": [ + 745, + 746 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 28, + "column": 28 + }, + "end": { + "line": 28, + "column": 29 + } + }, + "range": [ + 746, + 747 + ] + }, + { + "type": "String", + "value": "'from body'", + "loc": { + "start": { + "line": 28, + "column": 30 + }, + "end": { + "line": 28, + "column": 41 + } + }, + "range": [ + 748, + 759 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 28, + "column": 41 + }, + "end": { + "line": 28, + "column": 42 + } + }, + "range": [ + 759, + 760 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 28, + "column": 42 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 760, + 761 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.src.js new file mode 100644 index 00000000..85e4fbc3 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-accessor.src.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within accessor methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + ({ + set accessor(x = fromParam = await) { + fromBody = await; + } + }).accessor = undefined; + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.module-result.js new file mode 100644 index 00000000..90f4b361 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 490, + "lineNumber": 14, + "column": 5, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.result.js new file mode 100644 index 00000000..920521b0 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.result.js @@ -0,0 +1,2153 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 486, + 752 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 486, + 500 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 490, + 499 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 490, + 495 + ], + "name": "await" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 498, + 499 + ], + "value": 0, + "raw": "0" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 501, + 525 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 505, + 514 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 505, + 514 + ], + "name": "fromParam" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 516, + 524 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 516, + 524 + ], + "name": "fromBody" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 527, + 657 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 533, + 534 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 535, + 657 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 539, + 655 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 23 + } + }, + "range": [ + 552, + 651 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "range": [ + 552, + 650 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 20 + } + }, + "range": [ + 552, + 648 + ], + "object": { + "type": "CallExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 15 + } + }, + "range": [ + 552, + 643 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 13 + } + }, + "range": [ + 552, + 641 + ], + "object": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 553, + 633 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 561, + 627 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 13 + } + }, + "range": [ + 562, + 568 + ], + "name": "method" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 20, + "column": 13 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 568, + 627 + ], + "id": null, + "expression": false, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 20, + "column": 35 + } + }, + "range": [ + 569, + 590 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 569, + 570 + ], + "name": "x" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 35 + } + }, + "range": [ + 573, + 590 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 27 + } + }, + "range": [ + 573, + 582 + ], + "name": "fromParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 30 + }, + "end": { + "line": 20, + "column": 35 + } + }, + "range": [ + 585, + 590 + ], + "name": "await" + } + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 20, + "column": 37 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 592, + 627 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "range": [ + 602, + 619 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 602, + 618 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 602, + 610 + ], + "name": "fromBody" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 613, + 618 + ], + "name": "await" + } + } + } + ] + } + } + } + ] + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 13 + } + }, + "range": [ + 635, + 641 + ], + "name": "method" + }, + "computed": false, + "optional": false + }, + "arguments": [], + "optional": false + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 20 + } + }, + "range": [ + 644, + 648 + ], + "name": "next" + }, + "computed": false, + "optional": false + }, + "arguments": [], + "optional": false + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 49 + } + }, + "range": [ + 659, + 708 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 48 + } + }, + "range": [ + 659, + 707 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 659, + 675 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 659, + 665 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 666, + 675 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "range": [ + 676, + 685 + ], + "name": "fromParam" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "range": [ + 687, + 688 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 47 + } + }, + "range": [ + 690, + 706 + ], + "value": "from parameter", + "raw": "'from parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 709, + 752 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 42 + } + }, + "range": [ + 709, + 751 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 709, + 725 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + }, + "range": [ + 709, + 715 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 716, + 725 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "range": [ + 726, + 734 + ], + "name": "fromBody" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 28 + } + }, + "range": [ + 736, + 737 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 28, + "column": 30 + }, + "end": { + "line": 28, + "column": 41 + } + }, + "range": [ + 739, + 750 + ], + "value": "from body", + "raw": "'from body'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + }, + "range": [ + 486, + 489 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 490, + 495 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 499, + 500 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 501, + 504 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 505, + 514 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + }, + "range": [ + 514, + 515 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 516, + 524 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 524, + 525 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 527, + 532 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 533, + 534 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 535, + 536 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 539, + 545 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 546, + 547 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + }, + "range": [ + 552, + 553 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 6 + } + }, + "range": [ + 553, + 554 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 7 + } + }, + "range": [ + 561, + 562 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 13 + } + }, + "range": [ + 562, + 568 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 20, + "column": 13 + }, + "end": { + "line": 20, + "column": 14 + } + }, + "range": [ + 568, + 569 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 569, + 570 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 17 + } + }, + "range": [ + 571, + 572 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 27 + } + }, + "range": [ + 573, + 582 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 28 + }, + "end": { + "line": 20, + "column": 29 + } + }, + "range": [ + 583, + 584 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 20, + "column": 30 + }, + "end": { + "line": 20, + "column": 35 + } + }, + "range": [ + 585, + 590 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 20, + "column": 35 + }, + "end": { + "line": 20, + "column": 36 + } + }, + "range": [ + 590, + 591 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 20, + "column": 37 + }, + "end": { + "line": 20, + "column": 38 + } + }, + "range": [ + 592, + 593 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 602, + 610 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 18 + } + }, + "range": [ + 611, + 612 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 613, + 618 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "range": [ + 618, + 619 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 626, + 627 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 632, + 633 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 633, + 634 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + }, + "range": [ + 634, + 635 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 13 + } + }, + "range": [ + 635, + 641 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 23, + "column": 13 + }, + "end": { + "line": 23, + "column": 14 + } + }, + "range": [ + 641, + 642 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 15 + } + }, + "range": [ + 642, + 643 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 643, + 644 + ] + }, + { + "type": "Identifier", + "value": "next", + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 20 + } + }, + "range": [ + 644, + 648 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 23, + "column": 20 + }, + "end": { + "line": 23, + "column": 21 + } + }, + "range": [ + 648, + 649 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "range": [ + 649, + 650 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 23 + } + }, + "range": [ + 650, + 651 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 654, + 655 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 656, + 657 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 659, + 665 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 665, + 666 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 666, + 675 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "range": [ + 675, + 676 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "range": [ + 676, + 685 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "range": [ + 685, + 686 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "range": [ + 687, + 688 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "range": [ + 688, + 689 + ] + }, + { + "type": "String", + "value": "'from parameter'", + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 47 + } + }, + "range": [ + 690, + 706 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 47 + }, + "end": { + "line": 27, + "column": 48 + } + }, + "range": [ + 706, + 707 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 27, + "column": 48 + }, + "end": { + "line": 27, + "column": 49 + } + }, + "range": [ + 707, + 708 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + }, + "range": [ + 709, + 715 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 28, + "column": 6 + }, + "end": { + "line": 28, + "column": 7 + } + }, + "range": [ + 715, + 716 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 716, + 725 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 28, + "column": 16 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "range": [ + 725, + 726 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "range": [ + 726, + 734 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 26 + } + }, + "range": [ + 734, + 735 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 28 + } + }, + "range": [ + 736, + 737 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 28, + "column": 28 + }, + "end": { + "line": 28, + "column": 29 + } + }, + "range": [ + 737, + 738 + ] + }, + { + "type": "String", + "value": "'from body'", + "loc": { + "start": { + "line": 28, + "column": 30 + }, + "end": { + "line": 28, + "column": 41 + } + }, + "range": [ + 739, + 750 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 28, + "column": 41 + }, + "end": { + "line": 28, + "column": 42 + } + }, + "range": [ + 750, + 751 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 28, + "column": 42 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 751, + 752 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.src.js new file mode 100644 index 00000000..eaaf7a4b --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-generator.src.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within generator methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + ({ + *method(x = fromParam = await) { + fromBody = await; + } + }).method().next(); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.module-result.js new file mode 100644 index 00000000..f825f4ce --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 480, + "lineNumber": 14, + "column": 5, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.result.js new file mode 100644 index 00000000..7cd30297 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.result.js @@ -0,0 +1,2007 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 476, + 734 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 476, + 490 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 480, + 489 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 480, + 485 + ], + "name": "await" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 488, + 489 + ], + "value": 0, + "raw": "0" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 491, + 515 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 495, + 504 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 495, + 504 + ], + "name": "fromParam" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 506, + 514 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 506, + 514 + ], + "name": "fromBody" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 517, + 639 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 523, + 524 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 525, + 639 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 529, + 637 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 542, + 633 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 15 + } + }, + "range": [ + 542, + 632 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 23, + "column": 13 + } + }, + "range": [ + 542, + 630 + ], + "object": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 543, + 622 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 551, + 616 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 12 + } + }, + "range": [ + 551, + 557 + ], + "name": "method" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 557, + 616 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 20, + "column": 13 + }, + "end": { + "line": 20, + "column": 34 + } + }, + "range": [ + 558, + 579 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 13 + }, + "end": { + "line": 20, + "column": 14 + } + }, + "range": [ + 558, + 559 + ], + "name": "x" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 34 + } + }, + "range": [ + 562, + 579 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 26 + } + }, + "range": [ + 562, + 571 + ], + "name": "fromParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 29 + }, + "end": { + "line": 20, + "column": 34 + } + }, + "range": [ + 574, + 579 + ], + "name": "await" + } + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 20, + "column": 36 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 581, + 616 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "range": [ + 591, + 608 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 591, + 607 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 591, + 599 + ], + "name": "fromBody" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 602, + 607 + ], + "name": "await" + } + } + } + ] + } + } + } + ] + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 13 + } + }, + "range": [ + 624, + 630 + ], + "name": "method" + }, + "computed": false, + "optional": false + }, + "arguments": [], + "optional": false + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 49 + } + }, + "range": [ + 641, + 690 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 48 + } + }, + "range": [ + 641, + 689 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 641, + 657 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 641, + 647 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 648, + 657 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "range": [ + 658, + 667 + ], + "name": "fromParam" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "range": [ + 669, + 670 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 47 + } + }, + "range": [ + 672, + 688 + ], + "value": "from parameter", + "raw": "'from parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 691, + 734 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 42 + } + }, + "range": [ + 691, + 733 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 691, + 707 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + }, + "range": [ + 691, + 697 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 698, + 707 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "range": [ + 708, + 716 + ], + "name": "fromBody" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 28 + } + }, + "range": [ + 718, + 719 + ], + "value": 0, + "raw": "0" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 28, + "column": 30 + }, + "end": { + "line": 28, + "column": 41 + } + }, + "range": [ + 721, + 732 + ], + "value": "from body", + "raw": "'from body'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + }, + "range": [ + 476, + 479 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 480, + 485 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + }, + "range": [ + 486, + 487 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 13 + } + }, + "range": [ + 488, + 489 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 14 + } + }, + "range": [ + 489, + 490 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 491, + 494 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 495, + 504 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + }, + "range": [ + 504, + 505 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 23 + } + }, + "range": [ + 506, + 514 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + }, + "range": [ + 514, + 515 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 517, + 522 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 523, + 524 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 525, + 526 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 529, + 535 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 536, + 537 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 5 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 6 + } + }, + "range": [ + 543, + 544 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 12 + } + }, + "range": [ + 551, + 557 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 13 + } + }, + "range": [ + 557, + 558 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 20, + "column": 13 + }, + "end": { + "line": 20, + "column": 14 + } + }, + "range": [ + 558, + 559 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 16 + } + }, + "range": [ + 560, + 561 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 26 + } + }, + "range": [ + 562, + 571 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 27 + }, + "end": { + "line": 20, + "column": 28 + } + }, + "range": [ + 572, + 573 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 20, + "column": 29 + }, + "end": { + "line": 20, + "column": 34 + } + }, + "range": [ + 574, + 579 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 20, + "column": 34 + }, + "end": { + "line": 20, + "column": 35 + } + }, + "range": [ + 579, + 580 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 20, + "column": 36 + }, + "end": { + "line": 20, + "column": 37 + } + }, + "range": [ + 581, + 582 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "range": [ + 591, + 599 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 18 + } + }, + "range": [ + 600, + 601 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 602, + 607 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "range": [ + 607, + 608 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 615, + 616 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 621, + 622 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 622, + 623 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + }, + "range": [ + 623, + 624 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 13 + } + }, + "range": [ + 624, + 630 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 23, + "column": 13 + }, + "end": { + "line": 23, + "column": 14 + } + }, + "range": [ + 630, + 631 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 15 + } + }, + "range": [ + 631, + 632 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 632, + 633 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 636, + 637 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 638, + 639 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 641, + 647 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 647, + 648 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 648, + 657 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "range": [ + 657, + 658 + ] + }, + { + "type": "Identifier", + "value": "fromParam", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "range": [ + 658, + 667 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "range": [ + 667, + 668 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "range": [ + 669, + 670 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "range": [ + 670, + 671 + ] + }, + { + "type": "String", + "value": "'from parameter'", + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 47 + } + }, + "range": [ + 672, + 688 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 47 + }, + "end": { + "line": 27, + "column": 48 + } + }, + "range": [ + 688, + 689 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 27, + "column": 48 + }, + "end": { + "line": 27, + "column": 49 + } + }, + "range": [ + 689, + 690 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 6 + } + }, + "range": [ + 691, + 697 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 28, + "column": 6 + }, + "end": { + "line": 28, + "column": 7 + } + }, + "range": [ + 697, + 698 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "range": [ + 698, + 707 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 28, + "column": 16 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "range": [ + 707, + 708 + ] + }, + { + "type": "Identifier", + "value": "fromBody", + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "range": [ + 708, + 716 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 26 + } + }, + "range": [ + 716, + 717 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 28 + } + }, + "range": [ + 718, + 719 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 28, + "column": 28 + }, + "end": { + "line": 28, + "column": 29 + } + }, + "range": [ + 719, + 720 + ] + }, + { + "type": "String", + "value": "'from body'", + "loc": { + "start": { + "line": 28, + "column": 30 + }, + "end": { + "line": 28, + "column": 41 + } + }, + "range": [ + 721, + 732 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 28, + "column": 41 + }, + "end": { + "line": 28, + "column": 42 + } + }, + "range": [ + 732, + 733 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 28, + "column": 42 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "range": [ + 733, + 734 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.src.js new file mode 100644 index 00000000..bafa30e4 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/expressions-object-method-definition-static-init-await-reference-normal.src.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + ({ + method(x = fromParam = await) { + fromBody = await; + } + }).method(); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/identifier-resolution-static-init-invalid-await.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/identifier-resolution-static-init-invalid-await.result.js new file mode 100644 index 00000000..fe939343 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/identifier-resolution-static-init-invalid-await.result.js @@ -0,0 +1,6 @@ +export default { + "index": 677, + "lineNumber": 23, + "column": 5, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/identifier-resolution-static-init-invalid-await.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/identifier-resolution-static-init-invalid-await.src.js new file mode 100644 index 00000000..61ddd625 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/identifier-resolution-static-init-invalid-await.src.js @@ -0,0 +1,25 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Restriction on `await` +info: | + IdentifierReference : Identifier + + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "arguments" or "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + await; + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-break-static-init-without-label.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-break-static-init-without-label.result.js new file mode 100644 index 00000000..c82690a2 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-break-static-init-without-label.result.js @@ -0,0 +1,6 @@ +export default { + "index": 733, + "lineNumber": 24, + "column": 7, + "message": "Unsyntactic break" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-break-static-init-without-label.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-break-static-init-without-label.src.js new file mode 100644 index 00000000..2caeeaba --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-break-static-init-without-label.src.js @@ -0,0 +1,27 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-break-statement +description: IterationStatement search does not traverse static initialization block boundaries (no label specified) +info: | + 4.2.1 Static Semantics: Early Errors + BreakStatement : break ; + + - It is a Syntax Error if this BreakStatement is not nested, directly or + indirectly (but not crossing function or static initialization block + boundaries), within an IterationStatement or a SwitchStatement. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +label: while(false) { + class C { + static { + break; + } + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-abrupt.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-abrupt.result.js new file mode 100644 index 00000000..29876ec8 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-abrupt.result.js @@ -0,0 +1,3451 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 46, + "column": 61 + } + }, + "range": [ + 977, + 1523 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 32 + } + }, + "range": [ + 977, + 1009 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 31 + } + }, + "range": [ + 981, + 1008 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 10 + } + }, + "range": [ + 981, + 987 + ], + "name": "thrown" + }, + "init": { + "type": "NewExpression", + "loc": { + "start": { + "line": 22, + "column": 13 + }, + "end": { + "line": 22, + "column": 31 + } + }, + "range": [ + 990, + 1008 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 29 + } + }, + "range": [ + 994, + 1006 + ], + "name": "Test262Error" + }, + "arguments": [] + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 11 + } + }, + "range": [ + 1010, + 1021 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 10 + } + }, + "range": [ + 1014, + 1020 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 10 + } + }, + "range": [ + 1014, + 1020 + ], + "name": "caught" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 22 + } + }, + "range": [ + 1022, + 1044 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 21 + } + }, + "range": [ + 1026, + 1043 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 13 + } + }, + "range": [ + 1026, + 1035 + ], + "name": "sameBlock" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 21 + } + }, + "range": [ + 1038, + 1043 + ], + "value": false, + "raw": "false" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 28 + } + }, + "range": [ + 1045, + 1073 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "range": [ + 1049, + 1072 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 19 + } + }, + "range": [ + 1049, + 1064 + ], + "name": "subsequentField" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "range": [ + 1067, + 1072 + ], + "value": false, + "raw": "false" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 28 + } + }, + "range": [ + 1074, + 1102 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "range": [ + 1078, + 1101 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 19 + } + }, + "range": [ + 1078, + 1093 + ], + "name": "subsequentBlock" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 26, + "column": 22 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "range": [ + 1096, + 1101 + ], + "value": false, + "raw": "false" + } + } + ], + "kind": "var" + }, + { + "type": "TryStatement", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 41, + "column": 1 + } + }, + "range": [ + 1104, + 1314 + ], + "block": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 39, + "column": 1 + } + }, + "range": [ + 1108, + 1278 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 38, + "column": 3 + } + }, + "range": [ + 1112, + 1276 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 9 + } + }, + "range": [ + 1118, + 1119 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 29, + "column": 10 + }, + "end": { + "line": 38, + "column": 3 + } + }, + "range": [ + 1120, + 1276 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 30, + "column": 4 + }, + "end": { + "line": 33, + "column": 5 + } + }, + "range": [ + 1126, + 1184 + ], + "body": [ + { + "type": "ThrowStatement", + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 19 + } + }, + "range": [ + 1141, + 1154 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 18 + } + }, + "range": [ + 1147, + 1153 + ], + "name": "thrown" + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 32, + "column": 6 + }, + "end": { + "line": 32, + "column": 23 + } + }, + "range": [ + 1161, + 1178 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 32, + "column": 6 + }, + "end": { + "line": 32, + "column": 22 + } + }, + "range": [ + 1161, + 1177 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 32, + "column": 6 + }, + "end": { + "line": 32, + "column": 15 + } + }, + "range": [ + 1161, + 1170 + ], + "name": "sameBlock" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 32, + "column": 18 + }, + "end": { + "line": 32, + "column": 22 + } + }, + "range": [ + 1173, + 1177 + ], + "value": true, + "raw": "true" + } + } + } + ] + }, + { + "type": "PropertyDefinition", + "loc": { + "start": { + "line": 34, + "column": 4 + }, + "end": { + "line": 34, + "column": 38 + } + }, + "range": [ + 1189, + 1223 + ], + "static": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 12 + } + }, + "range": [ + 1196, + 1197 + ], + "name": "x" + }, + "value": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 34, + "column": 15 + }, + "end": { + "line": 34, + "column": 37 + } + }, + "range": [ + 1200, + 1222 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 34, + "column": 15 + }, + "end": { + "line": 34, + "column": 30 + } + }, + "range": [ + 1200, + 1215 + ], + "name": "subsequentField" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 34, + "column": 33 + }, + "end": { + "line": 34, + "column": 37 + } + }, + "range": [ + 1218, + 1222 + ], + "value": true, + "raw": "true" + } + } + }, + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 35, + "column": 4 + }, + "end": { + "line": 37, + "column": 5 + } + }, + "range": [ + 1228, + 1272 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 36, + "column": 6 + }, + "end": { + "line": 36, + "column": 29 + } + }, + "range": [ + 1243, + 1266 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 36, + "column": 6 + }, + "end": { + "line": 36, + "column": 28 + } + }, + "range": [ + 1243, + 1265 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 36, + "column": 6 + }, + "end": { + "line": 36, + "column": 21 + } + }, + "range": [ + 1243, + 1258 + ], + "name": "subsequentBlock" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 36, + "column": 24 + }, + "end": { + "line": 36, + "column": 28 + } + }, + "range": [ + 1261, + 1265 + ], + "value": true, + "raw": "true" + } + } + } + ] + } + ] + } + } + ] + }, + "handler": { + "type": "CatchClause", + "loc": { + "start": { + "line": 39, + "column": 2 + }, + "end": { + "line": 41, + "column": 1 + } + }, + "range": [ + 1279, + 1314 + ], + "param": { + "type": "Identifier", + "loc": { + "start": { + "line": 39, + "column": 9 + }, + "end": { + "line": 39, + "column": 14 + } + }, + "range": [ + 1286, + 1291 + ], + "name": "error" + }, + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 39, + "column": 16 + }, + "end": { + "line": 41, + "column": 1 + } + }, + "range": [ + 1293, + 1314 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 17 + } + }, + "range": [ + 1297, + 1312 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 16 + } + }, + "range": [ + 1297, + 1311 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 8 + } + }, + "range": [ + 1297, + 1303 + ], + "name": "caught" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 40, + "column": 11 + }, + "end": { + "line": 40, + "column": 16 + } + }, + "range": [ + 1306, + 1311 + ], + "name": "error" + } + } + } + ] + } + }, + "finalizer": null + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 43, + "column": 0 + }, + "end": { + "line": 43, + "column": 33 + } + }, + "range": [ + 1316, + 1349 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 43, + "column": 0 + }, + "end": { + "line": 43, + "column": 32 + } + }, + "range": [ + 1316, + 1348 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 43, + "column": 0 + }, + "end": { + "line": 43, + "column": 16 + } + }, + "range": [ + 1316, + 1332 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 43, + "column": 0 + }, + "end": { + "line": 43, + "column": 6 + } + }, + "range": [ + 1316, + 1322 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 43, + "column": 7 + }, + "end": { + "line": 43, + "column": 16 + } + }, + "range": [ + 1323, + 1332 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 43, + "column": 17 + }, + "end": { + "line": 43, + "column": 23 + } + }, + "range": [ + 1333, + 1339 + ], + "name": "caught" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 43, + "column": 25 + }, + "end": { + "line": 43, + "column": 31 + } + }, + "range": [ + 1341, + 1347 + ], + "name": "thrown" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 49 + } + }, + "range": [ + 1350, + 1399 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 48 + } + }, + "range": [ + 1350, + 1398 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 16 + } + }, + "range": [ + 1350, + 1366 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 6 + } + }, + "range": [ + 1350, + 1356 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 44, + "column": 7 + }, + "end": { + "line": 44, + "column": 16 + } + }, + "range": [ + 1357, + 1366 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 44, + "column": 17 + }, + "end": { + "line": 44, + "column": 26 + } + }, + "range": [ + 1367, + 1376 + ], + "name": "sameBlock" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 44, + "column": 28 + }, + "end": { + "line": 44, + "column": 33 + } + }, + "range": [ + 1378, + 1383 + ], + "value": false, + "raw": "false" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 44, + "column": 35 + }, + "end": { + "line": 44, + "column": 47 + } + }, + "range": [ + 1385, + 1397 + ], + "value": "same block", + "raw": "'same block'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 61 + } + }, + "range": [ + 1400, + 1461 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 60 + } + }, + "range": [ + 1400, + 1460 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 16 + } + }, + "range": [ + 1400, + 1416 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 6 + } + }, + "range": [ + 1400, + 1406 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 45, + "column": 7 + }, + "end": { + "line": 45, + "column": 16 + } + }, + "range": [ + 1407, + 1416 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 32 + } + }, + "range": [ + 1417, + 1432 + ], + "name": "subsequentField" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 45, + "column": 34 + }, + "end": { + "line": 45, + "column": 39 + } + }, + "range": [ + 1434, + 1439 + ], + "value": false, + "raw": "false" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 45, + "column": 41 + }, + "end": { + "line": 45, + "column": 59 + } + }, + "range": [ + 1441, + 1459 + ], + "value": "subsequent field", + "raw": "'subsequent field'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 61 + } + }, + "range": [ + 1462, + 1523 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 60 + } + }, + "range": [ + 1462, + 1522 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 16 + } + }, + "range": [ + 1462, + 1478 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 6 + } + }, + "range": [ + 1462, + 1468 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 46, + "column": 7 + }, + "end": { + "line": 46, + "column": 16 + } + }, + "range": [ + 1469, + 1478 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 46, + "column": 17 + }, + "end": { + "line": 46, + "column": 32 + } + }, + "range": [ + 1479, + 1494 + ], + "name": "subsequentBlock" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 46, + "column": 34 + }, + "end": { + "line": 46, + "column": 39 + } + }, + "range": [ + 1496, + 1501 + ], + "value": false, + "raw": "false" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 46, + "column": 41 + }, + "end": { + "line": 46, + "column": 59 + } + }, + "range": [ + 1503, + 1521 + ], + "value": "subsequent block", + "raw": "'subsequent block'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 977, + 980 + ] + }, + { + "type": "Identifier", + "value": "thrown", + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 10 + } + }, + "range": [ + 981, + 987 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 22, + "column": 11 + }, + "end": { + "line": 22, + "column": 12 + } + }, + "range": [ + 988, + 989 + ] + }, + { + "type": "Keyword", + "value": "new", + "loc": { + "start": { + "line": 22, + "column": 13 + }, + "end": { + "line": 22, + "column": 16 + } + }, + "range": [ + 990, + 993 + ] + }, + { + "type": "Identifier", + "value": "Test262Error", + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 29 + } + }, + "range": [ + 994, + 1006 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 30 + } + }, + "range": [ + 1006, + 1007 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 22, + "column": 30 + }, + "end": { + "line": 22, + "column": 31 + } + }, + "range": [ + 1007, + 1008 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 22, + "column": 31 + }, + "end": { + "line": 22, + "column": 32 + } + }, + "range": [ + 1008, + 1009 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 3 + } + }, + "range": [ + 1010, + 1013 + ] + }, + { + "type": "Identifier", + "value": "caught", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 10 + } + }, + "range": [ + 1014, + 1020 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 11 + } + }, + "range": [ + 1020, + 1021 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 1022, + 1025 + ] + }, + { + "type": "Identifier", + "value": "sameBlock", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 13 + } + }, + "range": [ + 1026, + 1035 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 24, + "column": 14 + }, + "end": { + "line": 24, + "column": 15 + } + }, + "range": [ + 1036, + 1037 + ] + }, + { + "type": "Boolean", + "value": "false", + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 21 + } + }, + "range": [ + 1038, + 1043 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 22 + } + }, + "range": [ + 1043, + 1044 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 3 + } + }, + "range": [ + 1045, + 1048 + ] + }, + { + "type": "Identifier", + "value": "subsequentField", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 19 + } + }, + "range": [ + 1049, + 1064 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 25, + "column": 20 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 1065, + 1066 + ] + }, + { + "type": "Boolean", + "value": "false", + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "range": [ + 1067, + 1072 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 28 + } + }, + "range": [ + 1072, + 1073 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 3 + } + }, + "range": [ + 1074, + 1077 + ] + }, + { + "type": "Identifier", + "value": "subsequentBlock", + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 19 + } + }, + "range": [ + 1078, + 1093 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 26, + "column": 20 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "range": [ + 1094, + 1095 + ] + }, + { + "type": "Boolean", + "value": "false", + "loc": { + "start": { + "line": 26, + "column": 22 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "range": [ + 1096, + 1101 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 26, + "column": 27 + }, + "end": { + "line": 26, + "column": 28 + } + }, + "range": [ + 1101, + 1102 + ] + }, + { + "type": "Keyword", + "value": "try", + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 3 + } + }, + "range": [ + 1104, + 1107 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 28, + "column": 5 + } + }, + "range": [ + 1108, + 1109 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 7 + } + }, + "range": [ + 1112, + 1117 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 9 + } + }, + "range": [ + 1118, + 1119 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 29, + "column": 10 + }, + "end": { + "line": 29, + "column": 11 + } + }, + "range": [ + 1120, + 1121 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 30, + "column": 4 + }, + "end": { + "line": 30, + "column": 10 + } + }, + "range": [ + 1126, + 1132 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 12 + } + }, + "range": [ + 1133, + 1134 + ] + }, + { + "type": "Keyword", + "value": "throw", + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 11 + } + }, + "range": [ + 1141, + 1146 + ] + }, + { + "type": "Identifier", + "value": "thrown", + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 18 + } + }, + "range": [ + 1147, + 1153 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 31, + "column": 18 + }, + "end": { + "line": 31, + "column": 19 + } + }, + "range": [ + 1153, + 1154 + ] + }, + { + "type": "Identifier", + "value": "sameBlock", + "loc": { + "start": { + "line": 32, + "column": 6 + }, + "end": { + "line": 32, + "column": 15 + } + }, + "range": [ + 1161, + 1170 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 32, + "column": 16 + }, + "end": { + "line": 32, + "column": 17 + } + }, + "range": [ + 1171, + 1172 + ] + }, + { + "type": "Boolean", + "value": "true", + "loc": { + "start": { + "line": 32, + "column": 18 + }, + "end": { + "line": 32, + "column": 22 + } + }, + "range": [ + 1173, + 1177 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 32, + "column": 22 + }, + "end": { + "line": 32, + "column": 23 + } + }, + "range": [ + 1177, + 1178 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 33, + "column": 4 + }, + "end": { + "line": 33, + "column": 5 + } + }, + "range": [ + 1183, + 1184 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 34, + "column": 4 + }, + "end": { + "line": 34, + "column": 10 + } + }, + "range": [ + 1189, + 1195 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 12 + } + }, + "range": [ + 1196, + 1197 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 34, + "column": 13 + }, + "end": { + "line": 34, + "column": 14 + } + }, + "range": [ + 1198, + 1199 + ] + }, + { + "type": "Identifier", + "value": "subsequentField", + "loc": { + "start": { + "line": 34, + "column": 15 + }, + "end": { + "line": 34, + "column": 30 + } + }, + "range": [ + 1200, + 1215 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 34, + "column": 31 + }, + "end": { + "line": 34, + "column": 32 + } + }, + "range": [ + 1216, + 1217 + ] + }, + { + "type": "Boolean", + "value": "true", + "loc": { + "start": { + "line": 34, + "column": 33 + }, + "end": { + "line": 34, + "column": 37 + } + }, + "range": [ + 1218, + 1222 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 34, + "column": 37 + }, + "end": { + "line": 34, + "column": 38 + } + }, + "range": [ + 1222, + 1223 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 35, + "column": 4 + }, + "end": { + "line": 35, + "column": 10 + } + }, + "range": [ + 1228, + 1234 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 35, + "column": 11 + }, + "end": { + "line": 35, + "column": 12 + } + }, + "range": [ + 1235, + 1236 + ] + }, + { + "type": "Identifier", + "value": "subsequentBlock", + "loc": { + "start": { + "line": 36, + "column": 6 + }, + "end": { + "line": 36, + "column": 21 + } + }, + "range": [ + 1243, + 1258 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 36, + "column": 22 + }, + "end": { + "line": 36, + "column": 23 + } + }, + "range": [ + 1259, + 1260 + ] + }, + { + "type": "Boolean", + "value": "true", + "loc": { + "start": { + "line": 36, + "column": 24 + }, + "end": { + "line": 36, + "column": 28 + } + }, + "range": [ + 1261, + 1265 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 36, + "column": 28 + }, + "end": { + "line": 36, + "column": 29 + } + }, + "range": [ + 1265, + 1266 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 37, + "column": 4 + }, + "end": { + "line": 37, + "column": 5 + } + }, + "range": [ + 1271, + 1272 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 3 + } + }, + "range": [ + 1275, + 1276 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 1 + } + }, + "range": [ + 1277, + 1278 + ] + }, + { + "type": "Keyword", + "value": "catch", + "loc": { + "start": { + "line": 39, + "column": 2 + }, + "end": { + "line": 39, + "column": 7 + } + }, + "range": [ + 1279, + 1284 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 39, + "column": 8 + }, + "end": { + "line": 39, + "column": 9 + } + }, + "range": [ + 1285, + 1286 + ] + }, + { + "type": "Identifier", + "value": "error", + "loc": { + "start": { + "line": 39, + "column": 9 + }, + "end": { + "line": 39, + "column": 14 + } + }, + "range": [ + 1286, + 1291 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 39, + "column": 14 + }, + "end": { + "line": 39, + "column": 15 + } + }, + "range": [ + 1291, + 1292 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 39, + "column": 16 + }, + "end": { + "line": 39, + "column": 17 + } + }, + "range": [ + 1293, + 1294 + ] + }, + { + "type": "Identifier", + "value": "caught", + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 8 + } + }, + "range": [ + 1297, + 1303 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 40, + "column": 9 + }, + "end": { + "line": 40, + "column": 10 + } + }, + "range": [ + 1304, + 1305 + ] + }, + { + "type": "Identifier", + "value": "error", + "loc": { + "start": { + "line": 40, + "column": 11 + }, + "end": { + "line": 40, + "column": 16 + } + }, + "range": [ + 1306, + 1311 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 40, + "column": 16 + }, + "end": { + "line": 40, + "column": 17 + } + }, + "range": [ + 1311, + 1312 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 41, + "column": 0 + }, + "end": { + "line": 41, + "column": 1 + } + }, + "range": [ + 1313, + 1314 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 43, + "column": 0 + }, + "end": { + "line": 43, + "column": 6 + } + }, + "range": [ + 1316, + 1322 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 43, + "column": 6 + }, + "end": { + "line": 43, + "column": 7 + } + }, + "range": [ + 1322, + 1323 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 43, + "column": 7 + }, + "end": { + "line": 43, + "column": 16 + } + }, + "range": [ + 1323, + 1332 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 43, + "column": 16 + }, + "end": { + "line": 43, + "column": 17 + } + }, + "range": [ + 1332, + 1333 + ] + }, + { + "type": "Identifier", + "value": "caught", + "loc": { + "start": { + "line": 43, + "column": 17 + }, + "end": { + "line": 43, + "column": 23 + } + }, + "range": [ + 1333, + 1339 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 43, + "column": 23 + }, + "end": { + "line": 43, + "column": 24 + } + }, + "range": [ + 1339, + 1340 + ] + }, + { + "type": "Identifier", + "value": "thrown", + "loc": { + "start": { + "line": 43, + "column": 25 + }, + "end": { + "line": 43, + "column": 31 + } + }, + "range": [ + 1341, + 1347 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 43, + "column": 31 + }, + "end": { + "line": 43, + "column": 32 + } + }, + "range": [ + 1347, + 1348 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 43, + "column": 32 + }, + "end": { + "line": 43, + "column": 33 + } + }, + "range": [ + 1348, + 1349 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 6 + } + }, + "range": [ + 1350, + 1356 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 44, + "column": 6 + }, + "end": { + "line": 44, + "column": 7 + } + }, + "range": [ + 1356, + 1357 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 44, + "column": 7 + }, + "end": { + "line": 44, + "column": 16 + } + }, + "range": [ + 1357, + 1366 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 44, + "column": 16 + }, + "end": { + "line": 44, + "column": 17 + } + }, + "range": [ + 1366, + 1367 + ] + }, + { + "type": "Identifier", + "value": "sameBlock", + "loc": { + "start": { + "line": 44, + "column": 17 + }, + "end": { + "line": 44, + "column": 26 + } + }, + "range": [ + 1367, + 1376 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 44, + "column": 26 + }, + "end": { + "line": 44, + "column": 27 + } + }, + "range": [ + 1376, + 1377 + ] + }, + { + "type": "Boolean", + "value": "false", + "loc": { + "start": { + "line": 44, + "column": 28 + }, + "end": { + "line": 44, + "column": 33 + } + }, + "range": [ + 1378, + 1383 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 44, + "column": 33 + }, + "end": { + "line": 44, + "column": 34 + } + }, + "range": [ + 1383, + 1384 + ] + }, + { + "type": "String", + "value": "'same block'", + "loc": { + "start": { + "line": 44, + "column": 35 + }, + "end": { + "line": 44, + "column": 47 + } + }, + "range": [ + 1385, + 1397 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 44, + "column": 47 + }, + "end": { + "line": 44, + "column": 48 + } + }, + "range": [ + 1397, + 1398 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 44, + "column": 48 + }, + "end": { + "line": 44, + "column": 49 + } + }, + "range": [ + 1398, + 1399 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 6 + } + }, + "range": [ + 1400, + 1406 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 45, + "column": 6 + }, + "end": { + "line": 45, + "column": 7 + } + }, + "range": [ + 1406, + 1407 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 45, + "column": 7 + }, + "end": { + "line": 45, + "column": 16 + } + }, + "range": [ + 1407, + 1416 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 45, + "column": 16 + }, + "end": { + "line": 45, + "column": 17 + } + }, + "range": [ + 1416, + 1417 + ] + }, + { + "type": "Identifier", + "value": "subsequentField", + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 32 + } + }, + "range": [ + 1417, + 1432 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 45, + "column": 32 + }, + "end": { + "line": 45, + "column": 33 + } + }, + "range": [ + 1432, + 1433 + ] + }, + { + "type": "Boolean", + "value": "false", + "loc": { + "start": { + "line": 45, + "column": 34 + }, + "end": { + "line": 45, + "column": 39 + } + }, + "range": [ + 1434, + 1439 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 45, + "column": 39 + }, + "end": { + "line": 45, + "column": 40 + } + }, + "range": [ + 1439, + 1440 + ] + }, + { + "type": "String", + "value": "'subsequent field'", + "loc": { + "start": { + "line": 45, + "column": 41 + }, + "end": { + "line": 45, + "column": 59 + } + }, + "range": [ + 1441, + 1459 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 45, + "column": 59 + }, + "end": { + "line": 45, + "column": 60 + } + }, + "range": [ + 1459, + 1460 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 45, + "column": 60 + }, + "end": { + "line": 45, + "column": 61 + } + }, + "range": [ + 1460, + 1461 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 6 + } + }, + "range": [ + 1462, + 1468 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 46, + "column": 6 + }, + "end": { + "line": 46, + "column": 7 + } + }, + "range": [ + 1468, + 1469 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 46, + "column": 7 + }, + "end": { + "line": 46, + "column": 16 + } + }, + "range": [ + 1469, + 1478 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 46, + "column": 16 + }, + "end": { + "line": 46, + "column": 17 + } + }, + "range": [ + 1478, + 1479 + ] + }, + { + "type": "Identifier", + "value": "subsequentBlock", + "loc": { + "start": { + "line": 46, + "column": 17 + }, + "end": { + "line": 46, + "column": 32 + } + }, + "range": [ + 1479, + 1494 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 46, + "column": 32 + }, + "end": { + "line": 46, + "column": 33 + } + }, + "range": [ + 1494, + 1495 + ] + }, + { + "type": "Boolean", + "value": "false", + "loc": { + "start": { + "line": 46, + "column": 34 + }, + "end": { + "line": 46, + "column": 39 + } + }, + "range": [ + 1496, + 1501 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 46, + "column": 39 + }, + "end": { + "line": 46, + "column": 40 + } + }, + "range": [ + 1501, + 1502 + ] + }, + { + "type": "String", + "value": "'subsequent block'", + "loc": { + "start": { + "line": 46, + "column": 41 + }, + "end": { + "line": 46, + "column": 59 + } + }, + "range": [ + 1503, + 1521 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 46, + "column": 59 + }, + "end": { + "line": 46, + "column": 60 + } + }, + "range": [ + 1521, + 1522 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 46, + "column": 60 + }, + "end": { + "line": 46, + "column": 61 + } + }, + "range": [ + 1522, + 1523 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-abrupt.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-abrupt.src.js new file mode 100644 index 00000000..c8270c10 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-abrupt.src.js @@ -0,0 +1,46 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Returns abrupt completion and halts further class body evaluation +info: | + 34. For each element elementRecord of staticElements in List order, do + a. If elementRecord is a ClassFieldDefinition Record, then + [...] + b. Else, + i. Assert: fieldRecord is a ClassStaticBlockDefinition Record. + ii. Let status be the result of performing EvaluateStaticBlock(F, + elementRecord). + d. If status is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateEnvironment to + outerPrivateEnvironment. + iii. Return Completion(status). +features: [class-static-fields-public, class-static-block] +---*/ + +var thrown = new Test262Error(); +var caught; +var sameBlock = false; +var subsequentField = false; +var subsequentBlock = false; + +try { + class C { + static { + throw thrown; + sameBlock = true; + } + static x = subsequentField = true; + static { + subsequentBlock = true; + } + } +} catch (error) { + caught = error; +} + +assert.sameValue(caught, thrown); +assert.sameValue(sameBlock, false, 'same block'); +assert.sameValue(subsequentField, false, 'subsequent field'); +assert.sameValue(subsequentBlock, false, 'subsequent block'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-functions.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-functions.result.js new file mode 100644 index 00000000..843345e0 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-functions.result.js @@ -0,0 +1,5588 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 40, + "column": 68 + } + }, + "range": [ + 504, + 1277 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "range": [ + 504, + 520 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 6 + } + }, + "range": [ + 508, + 510 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 6 + } + }, + "range": [ + 508, + 510 + ], + "name": "fn" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 15 + } + }, + "range": [ + 512, + 519 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 15 + } + }, + "range": [ + 512, + 519 + ], + "name": "fnParam" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 521, + 539 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 525, + 528 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 525, + 528 + ], + "name": "gen" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 17 + } + }, + "range": [ + 530, + 538 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 17 + } + }, + "range": [ + 530, + 538 + ], + "name": "genParam" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 26 + } + }, + "range": [ + 540, + 566 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 11 + } + }, + "range": [ + 544, + 551 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 11 + } + }, + "range": [ + 544, + 551 + ], + "name": "asyncFn" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 25 + } + }, + "range": [ + 553, + 565 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 25 + } + }, + "range": [ + 553, + 565 + ], + "name": "asyncFnParam" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 33, + "column": 1 + } + }, + "range": [ + 568, + 914 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + }, + "range": [ + 574, + 575 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 33, + "column": 1 + } + }, + "range": [ + 576, + 914 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 32, + "column": 3 + } + }, + "range": [ + 580, + 912 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 23, + "column": 19 + } + }, + "range": [ + 593, + 679 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 23, + "column": 18 + } + }, + "range": [ + 593, + 678 + ], + "callee": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 594, + 665 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 45 + } + }, + "range": [ + 603, + 634 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 21, + "column": 15 + }, + "end": { + "line": 21, + "column": 44 + } + }, + "range": [ + 604, + 633 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 15 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "range": [ + 604, + 611 + ], + "name": "test262" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 21, + "column": 15 + }, + "end": { + "line": 21, + "column": 44 + } + }, + "range": [ + 604, + 633 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 15 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "range": [ + 604, + 611 + ], + "name": "test262" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 44 + } + }, + "range": [ + 614, + 633 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 32 + } + }, + "range": [ + 614, + 621 + ], + "name": "fnParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 35 + }, + "end": { + "line": 21, + "column": 44 + } + }, + "range": [ + 624, + 633 + ], + "name": "arguments" + } + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 21, + "column": 47 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 636, + 665 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 21 + } + }, + "range": [ + 644, + 659 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 20 + } + }, + "range": [ + 644, + 658 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 8 + } + }, + "range": [ + 644, + 646 + ], + "name": "fn" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 22, + "column": 11 + }, + "end": { + "line": 22, + "column": 20 + } + }, + "range": [ + 649, + 658 + ], + "name": "arguments" + } + } + } + ] + } + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "range": [ + 667, + 677 + ], + "value": "function", + "raw": "'function'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 27, + "column": 36 + } + }, + "range": [ + 685, + 793 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 27, + "column": 35 + } + }, + "range": [ + 685, + 792 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 27, + "column": 33 + } + }, + "range": [ + 685, + 790 + ], + "object": { + "type": "CallExpression", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 27, + "column": 28 + } + }, + "range": [ + 685, + 785 + ], + "callee": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 25, + "column": 5 + }, + "end": { + "line": 27, + "column": 5 + } + }, + "range": [ + 686, + 762 + ], + "id": null, + "expression": false, + "generator": true, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 49 + } + }, + "range": [ + 698, + 730 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 699, + 729 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "range": [ + 699, + 706 + ], + "name": "test262" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 699, + 729 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "range": [ + 699, + 706 + ], + "name": "test262" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 709, + 729 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 36 + } + }, + "range": [ + 709, + 717 + ], + "name": "genParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 39 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 720, + 729 + ], + "name": "arguments" + } + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 25, + "column": 51 + }, + "end": { + "line": 27, + "column": 5 + } + }, + "range": [ + 732, + 762 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "range": [ + 740, + 756 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "range": [ + 740, + 755 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 9 + } + }, + "range": [ + 740, + 743 + ], + "name": "gen" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 12 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "range": [ + 746, + 755 + ], + "name": "arguments" + } + } + } + ] + } + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "range": [ + 764, + 784 + ], + "value": "generator function", + "raw": "'generator function'" + } + ], + "optional": false + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 33 + } + }, + "range": [ + 786, + 790 + ], + "name": "next" + }, + "computed": false, + "optional": false + }, + "arguments": [], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 31, + "column": 25 + } + }, + "range": [ + 799, + 908 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 31, + "column": 24 + } + }, + "range": [ + 799, + 907 + ], + "callee": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 29, + "column": 5 + }, + "end": { + "line": 31, + "column": 5 + } + }, + "range": [ + 800, + 888 + ], + "id": null, + "expression": false, + "generator": false, + "async": true, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 29, + "column": 21 + }, + "end": { + "line": 29, + "column": 57 + } + }, + "range": [ + 816, + 852 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 29, + "column": 22 + }, + "end": { + "line": 29, + "column": 56 + } + }, + "range": [ + 817, + 851 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 22 + }, + "end": { + "line": 29, + "column": 29 + } + }, + "range": [ + 817, + 824 + ], + "name": "test262" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 29, + "column": 22 + }, + "end": { + "line": 29, + "column": 56 + } + }, + "range": [ + 817, + 851 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 22 + }, + "end": { + "line": 29, + "column": 29 + } + }, + "range": [ + 817, + 824 + ], + "name": "test262" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 29, + "column": 32 + }, + "end": { + "line": 29, + "column": 56 + } + }, + "range": [ + 827, + 851 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 32 + }, + "end": { + "line": 29, + "column": 44 + } + }, + "range": [ + 827, + 839 + ], + "name": "asyncFnParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 47 + }, + "end": { + "line": 29, + "column": 56 + } + }, + "range": [ + 842, + 851 + ], + "name": "arguments" + } + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 29, + "column": 59 + }, + "end": { + "line": 31, + "column": 5 + } + }, + "range": [ + 854, + 888 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 30, + "column": 6 + }, + "end": { + "line": 30, + "column": 26 + } + }, + "range": [ + 862, + 882 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 30, + "column": 6 + }, + "end": { + "line": 30, + "column": 25 + } + }, + "range": [ + 862, + 881 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 30, + "column": 6 + }, + "end": { + "line": 30, + "column": 13 + } + }, + "range": [ + 862, + 869 + ], + "name": "asyncFn" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 30, + "column": 16 + }, + "end": { + "line": 30, + "column": 25 + } + }, + "range": [ + 872, + 881 + ], + "name": "arguments" + } + } + } + ] + } + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 23 + } + }, + "range": [ + 890, + 906 + ], + "value": "async function", + "raw": "'async function'" + } + ], + "optional": false + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 47 + } + }, + "range": [ + 916, + 963 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 46 + } + }, + "range": [ + 916, + 962 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 6 + } + }, + "range": [ + 916, + 922 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 35, + "column": 7 + }, + "end": { + "line": 35, + "column": 37 + } + }, + "range": [ + 923, + 953 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 35, + "column": 7 + }, + "end": { + "line": 35, + "column": 19 + } + }, + "range": [ + 923, + 935 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 35, + "column": 20 + }, + "end": { + "line": 35, + "column": 32 + } + }, + "range": [ + 936, + 948 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 35, + "column": 21 + }, + "end": { + "line": 35, + "column": 31 + } + }, + "range": [ + 937, + 947 + ], + "value": "function", + "raw": "'function'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 35, + "column": 34 + }, + "end": { + "line": 35, + "column": 36 + } + }, + "range": [ + 950, + 952 + ], + "name": "fn" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 35, + "column": 39 + }, + "end": { + "line": 35, + "column": 45 + } + }, + "range": [ + 955, + 961 + ], + "value": "body", + "raw": "'body'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 57 + } + }, + "range": [ + 964, + 1021 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 56 + } + }, + "range": [ + 964, + 1020 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 6 + } + }, + "range": [ + 964, + 970 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 36, + "column": 7 + }, + "end": { + "line": 36, + "column": 42 + } + }, + "range": [ + 971, + 1006 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 36, + "column": 7 + }, + "end": { + "line": 36, + "column": 19 + } + }, + "range": [ + 971, + 983 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 36, + "column": 20 + }, + "end": { + "line": 36, + "column": 32 + } + }, + "range": [ + 984, + 996 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 36, + "column": 21 + }, + "end": { + "line": 36, + "column": 31 + } + }, + "range": [ + 985, + 995 + ], + "value": "function", + "raw": "'function'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 36, + "column": 34 + }, + "end": { + "line": 36, + "column": 41 + } + }, + "range": [ + 998, + 1005 + ], + "name": "fnParam" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 36, + "column": 44 + }, + "end": { + "line": 36, + "column": 55 + } + }, + "range": [ + 1008, + 1019 + ], + "value": "parameter", + "raw": "'parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 58 + } + }, + "range": [ + 1022, + 1080 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 57 + } + }, + "range": [ + 1022, + 1079 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 6 + } + }, + "range": [ + 1022, + 1028 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 37, + "column": 7 + }, + "end": { + "line": 37, + "column": 48 + } + }, + "range": [ + 1029, + 1070 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 7 + }, + "end": { + "line": 37, + "column": 19 + } + }, + "range": [ + 1029, + 1041 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 42 + } + }, + "range": [ + 1042, + 1064 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 37, + "column": 21 + }, + "end": { + "line": 37, + "column": 41 + } + }, + "range": [ + 1043, + 1063 + ], + "value": "generator function", + "raw": "'generator function'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 44 + }, + "end": { + "line": 37, + "column": 47 + } + }, + "range": [ + 1066, + 1069 + ], + "name": "gen" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 37, + "column": 50 + }, + "end": { + "line": 37, + "column": 56 + } + }, + "range": [ + 1072, + 1078 + ], + "value": "body", + "raw": "'body'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 68 + } + }, + "range": [ + 1081, + 1149 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 67 + } + }, + "range": [ + 1081, + 1148 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 6 + } + }, + "range": [ + 1081, + 1087 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 53 + } + }, + "range": [ + 1088, + 1134 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 19 + } + }, + "range": [ + 1088, + 1100 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 38, + "column": 20 + }, + "end": { + "line": 38, + "column": 42 + } + }, + "range": [ + 1101, + 1123 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 41 + } + }, + "range": [ + 1102, + 1122 + ], + "value": "generator function", + "raw": "'generator function'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 38, + "column": 44 + }, + "end": { + "line": 38, + "column": 52 + } + }, + "range": [ + 1125, + 1133 + ], + "name": "genParam" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 38, + "column": 55 + }, + "end": { + "line": 38, + "column": 66 + } + }, + "range": [ + 1136, + 1147 + ], + "value": "parameter", + "raw": "'parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 58 + } + }, + "range": [ + 1150, + 1208 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 57 + } + }, + "range": [ + 1150, + 1207 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 6 + } + }, + "range": [ + 1150, + 1156 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 39, + "column": 7 + }, + "end": { + "line": 39, + "column": 48 + } + }, + "range": [ + 1157, + 1198 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 39, + "column": 7 + }, + "end": { + "line": 39, + "column": 19 + } + }, + "range": [ + 1157, + 1169 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 39, + "column": 20 + }, + "end": { + "line": 39, + "column": 38 + } + }, + "range": [ + 1170, + 1188 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 39, + "column": 21 + }, + "end": { + "line": 39, + "column": 37 + } + }, + "range": [ + 1171, + 1187 + ], + "value": "async function", + "raw": "'async function'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 39, + "column": 40 + }, + "end": { + "line": 39, + "column": 47 + } + }, + "range": [ + 1190, + 1197 + ], + "name": "asyncFn" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 39, + "column": 50 + }, + "end": { + "line": 39, + "column": 56 + } + }, + "range": [ + 1200, + 1206 + ], + "value": "body", + "raw": "'body'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 40, + "column": 0 + }, + "end": { + "line": 40, + "column": 68 + } + }, + "range": [ + 1209, + 1277 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 40, + "column": 0 + }, + "end": { + "line": 40, + "column": 67 + } + }, + "range": [ + 1209, + 1276 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 40, + "column": 0 + }, + "end": { + "line": 40, + "column": 6 + } + }, + "range": [ + 1209, + 1215 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 40, + "column": 7 + }, + "end": { + "line": 40, + "column": 53 + } + }, + "range": [ + 1216, + 1262 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 40, + "column": 7 + }, + "end": { + "line": 40, + "column": 19 + } + }, + "range": [ + 1216, + 1228 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 40, + "column": 20 + }, + "end": { + "line": 40, + "column": 38 + } + }, + "range": [ + 1229, + 1247 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 40, + "column": 21 + }, + "end": { + "line": 40, + "column": 37 + } + }, + "range": [ + 1230, + 1246 + ], + "value": "async function", + "raw": "'async function'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 40, + "column": 40 + }, + "end": { + "line": 40, + "column": 52 + } + }, + "range": [ + 1249, + 1261 + ], + "name": "asyncFnParam" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 40, + "column": 55 + }, + "end": { + "line": 40, + "column": 66 + } + }, + "range": [ + 1264, + 1275 + ], + "value": "parameter", + "raw": "'parameter'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 504, + 507 + ] + }, + { + "type": "Identifier", + "value": "fn", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 6 + } + }, + "range": [ + 508, + 510 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + }, + "range": [ + 510, + 511 + ] + }, + { + "type": "Identifier", + "value": "fnParam", + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 15 + } + }, + "range": [ + 512, + 519 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "range": [ + 519, + 520 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 3 + } + }, + "range": [ + 521, + 524 + ] + }, + { + "type": "Identifier", + "value": "gen", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 525, + 528 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + }, + "range": [ + 528, + 529 + ] + }, + { + "type": "Identifier", + "value": "genParam", + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 17 + } + }, + "range": [ + 530, + 538 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 538, + 539 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 540, + 543 + ] + }, + { + "type": "Identifier", + "value": "asyncFn", + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 11 + } + }, + "range": [ + 544, + 551 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 12 + } + }, + "range": [ + 551, + 552 + ] + }, + { + "type": "Identifier", + "value": "asyncFnParam", + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 25 + } + }, + "range": [ + 553, + 565 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 17, + "column": 25 + }, + "end": { + "line": 17, + "column": 26 + } + }, + "range": [ + 565, + 566 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 5 + } + }, + "range": [ + 568, + 573 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 7 + } + }, + "range": [ + 574, + 575 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "range": [ + 576, + 577 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 8 + } + }, + "range": [ + 580, + 586 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 20, + "column": 9 + }, + "end": { + "line": 20, + "column": 10 + } + }, + "range": [ + 587, + 588 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 5 + } + }, + "range": [ + 593, + 594 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 13 + } + }, + "range": [ + 594, + 602 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 14 + } + }, + "range": [ + 602, + 603 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 15 + } + }, + "range": [ + 603, + 604 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 21, + "column": 15 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "range": [ + 604, + 611 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 612, + 613 + ] + }, + { + "type": "Identifier", + "value": "fnParam", + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 32 + } + }, + "range": [ + 614, + 621 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 21, + "column": 33 + }, + "end": { + "line": 21, + "column": 34 + } + }, + "range": [ + 622, + 623 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 21, + "column": 35 + }, + "end": { + "line": 21, + "column": 44 + } + }, + "range": [ + 624, + 633 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 44 + }, + "end": { + "line": 21, + "column": 45 + } + }, + "range": [ + 633, + 634 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 21, + "column": 45 + }, + "end": { + "line": 21, + "column": 46 + } + }, + "range": [ + 634, + 635 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 21, + "column": 47 + }, + "end": { + "line": 21, + "column": 48 + } + }, + "range": [ + 636, + 637 + ] + }, + { + "type": "Identifier", + "value": "fn", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 8 + } + }, + "range": [ + 644, + 646 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 22, + "column": 10 + } + }, + "range": [ + 647, + 648 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 22, + "column": 11 + }, + "end": { + "line": 22, + "column": 20 + } + }, + "range": [ + 649, + 658 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 22, + "column": 20 + }, + "end": { + "line": 22, + "column": 21 + } + }, + "range": [ + 658, + 659 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 5 + } + }, + "range": [ + 664, + 665 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 5 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 665, + 666 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + }, + "range": [ + 666, + 667 + ] + }, + { + "type": "String", + "value": "'function'", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "range": [ + 667, + 677 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 18 + } + }, + "range": [ + 677, + 678 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 18 + }, + "end": { + "line": 23, + "column": 19 + } + }, + "range": [ + 678, + 679 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 5 + } + }, + "range": [ + 685, + 686 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 25, + "column": 5 + }, + "end": { + "line": 25, + "column": 13 + } + }, + "range": [ + 686, + 694 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 15 + } + }, + "range": [ + 695, + 696 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 17 + } + }, + "range": [ + 697, + 698 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 18 + } + }, + "range": [ + 698, + 699 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 25, + "column": 18 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "range": [ + 699, + 706 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "range": [ + 707, + 708 + ] + }, + { + "type": "Identifier", + "value": "genParam", + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 36 + } + }, + "range": [ + 709, + 717 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 25, + "column": 37 + }, + "end": { + "line": 25, + "column": 38 + } + }, + "range": [ + 718, + 719 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 25, + "column": 39 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 720, + 729 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 25, + "column": 48 + }, + "end": { + "line": 25, + "column": 49 + } + }, + "range": [ + 729, + 730 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 25, + "column": 49 + }, + "end": { + "line": 25, + "column": 50 + } + }, + "range": [ + 730, + 731 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 25, + "column": 51 + }, + "end": { + "line": 25, + "column": 52 + } + }, + "range": [ + 732, + 733 + ] + }, + { + "type": "Identifier", + "value": "gen", + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 9 + } + }, + "range": [ + 740, + 743 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 11 + } + }, + "range": [ + 744, + 745 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 26, + "column": 12 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "range": [ + 746, + 755 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "range": [ + 755, + 756 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 5 + } + }, + "range": [ + 761, + 762 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 5 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 762, + 763 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 763, + 764 + ] + }, + { + "type": "String", + "value": "'generator function'", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "range": [ + 764, + 784 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 27 + }, + "end": { + "line": 27, + "column": 28 + } + }, + "range": [ + 784, + 785 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "range": [ + 785, + 786 + ] + }, + { + "type": "Identifier", + "value": "next", + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 33 + } + }, + "range": [ + 786, + 790 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 27, + "column": 33 + }, + "end": { + "line": 27, + "column": 34 + } + }, + "range": [ + 790, + 791 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 34 + }, + "end": { + "line": 27, + "column": 35 + } + }, + "range": [ + 791, + 792 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 27, + "column": 35 + }, + "end": { + "line": 27, + "column": 36 + } + }, + "range": [ + 792, + 793 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 29, + "column": 5 + } + }, + "range": [ + 799, + 800 + ] + }, + { + "type": "Identifier", + "value": "async", + "loc": { + "start": { + "line": 29, + "column": 5 + }, + "end": { + "line": 29, + "column": 10 + } + }, + "range": [ + 800, + 805 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 19 + } + }, + "range": [ + 806, + 814 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 29, + "column": 20 + }, + "end": { + "line": 29, + "column": 21 + } + }, + "range": [ + 815, + 816 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 29, + "column": 21 + }, + "end": { + "line": 29, + "column": 22 + } + }, + "range": [ + 816, + 817 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 29, + "column": 22 + }, + "end": { + "line": 29, + "column": 29 + } + }, + "range": [ + 817, + 824 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 29, + "column": 30 + }, + "end": { + "line": 29, + "column": 31 + } + }, + "range": [ + 825, + 826 + ] + }, + { + "type": "Identifier", + "value": "asyncFnParam", + "loc": { + "start": { + "line": 29, + "column": 32 + }, + "end": { + "line": 29, + "column": 44 + } + }, + "range": [ + 827, + 839 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 29, + "column": 45 + }, + "end": { + "line": 29, + "column": 46 + } + }, + "range": [ + 840, + 841 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 29, + "column": 47 + }, + "end": { + "line": 29, + "column": 56 + } + }, + "range": [ + 842, + 851 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 29, + "column": 56 + }, + "end": { + "line": 29, + "column": 57 + } + }, + "range": [ + 851, + 852 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 29, + "column": 57 + }, + "end": { + "line": 29, + "column": 58 + } + }, + "range": [ + 852, + 853 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 29, + "column": 59 + }, + "end": { + "line": 29, + "column": 60 + } + }, + "range": [ + 854, + 855 + ] + }, + { + "type": "Identifier", + "value": "asyncFn", + "loc": { + "start": { + "line": 30, + "column": 6 + }, + "end": { + "line": 30, + "column": 13 + } + }, + "range": [ + 862, + 869 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 30, + "column": 14 + }, + "end": { + "line": 30, + "column": 15 + } + }, + "range": [ + 870, + 871 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 30, + "column": 16 + }, + "end": { + "line": 30, + "column": 25 + } + }, + "range": [ + 872, + 881 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 30, + "column": 25 + }, + "end": { + "line": 30, + "column": 26 + } + }, + "range": [ + 881, + 882 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 31, + "column": 4 + }, + "end": { + "line": 31, + "column": 5 + } + }, + "range": [ + 887, + 888 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 6 + } + }, + "range": [ + 888, + 889 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 7 + } + }, + "range": [ + 889, + 890 + ] + }, + { + "type": "String", + "value": "'async function'", + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 23 + } + }, + "range": [ + 890, + 906 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 31, + "column": 23 + }, + "end": { + "line": 31, + "column": 24 + } + }, + "range": [ + 906, + 907 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 31, + "column": 24 + }, + "end": { + "line": 31, + "column": 25 + } + }, + "range": [ + 907, + 908 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 3 + } + }, + "range": [ + 911, + 912 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 33, + "column": 0 + }, + "end": { + "line": 33, + "column": 1 + } + }, + "range": [ + 913, + 914 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 6 + } + }, + "range": [ + 916, + 922 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 35, + "column": 6 + }, + "end": { + "line": 35, + "column": 7 + } + }, + "range": [ + 922, + 923 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 35, + "column": 7 + }, + "end": { + "line": 35, + "column": 19 + } + }, + "range": [ + 923, + 935 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 35, + "column": 19 + }, + "end": { + "line": 35, + "column": 20 + } + }, + "range": [ + 935, + 936 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 35, + "column": 20 + }, + "end": { + "line": 35, + "column": 21 + } + }, + "range": [ + 936, + 937 + ] + }, + { + "type": "String", + "value": "'function'", + "loc": { + "start": { + "line": 35, + "column": 21 + }, + "end": { + "line": 35, + "column": 31 + } + }, + "range": [ + 937, + 947 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 35, + "column": 31 + }, + "end": { + "line": 35, + "column": 32 + } + }, + "range": [ + 947, + 948 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 35, + "column": 32 + }, + "end": { + "line": 35, + "column": 33 + } + }, + "range": [ + 948, + 949 + ] + }, + { + "type": "Identifier", + "value": "fn", + "loc": { + "start": { + "line": 35, + "column": 34 + }, + "end": { + "line": 35, + "column": 36 + } + }, + "range": [ + 950, + 952 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 35, + "column": 36 + }, + "end": { + "line": 35, + "column": 37 + } + }, + "range": [ + 952, + 953 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 35, + "column": 37 + }, + "end": { + "line": 35, + "column": 38 + } + }, + "range": [ + 953, + 954 + ] + }, + { + "type": "String", + "value": "'body'", + "loc": { + "start": { + "line": 35, + "column": 39 + }, + "end": { + "line": 35, + "column": 45 + } + }, + "range": [ + 955, + 961 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 35, + "column": 45 + }, + "end": { + "line": 35, + "column": 46 + } + }, + "range": [ + 961, + 962 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 35, + "column": 46 + }, + "end": { + "line": 35, + "column": 47 + } + }, + "range": [ + 962, + 963 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 6 + } + }, + "range": [ + 964, + 970 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 36, + "column": 6 + }, + "end": { + "line": 36, + "column": 7 + } + }, + "range": [ + 970, + 971 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 36, + "column": 7 + }, + "end": { + "line": 36, + "column": 19 + } + }, + "range": [ + 971, + 983 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 36, + "column": 19 + }, + "end": { + "line": 36, + "column": 20 + } + }, + "range": [ + 983, + 984 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 36, + "column": 20 + }, + "end": { + "line": 36, + "column": 21 + } + }, + "range": [ + 984, + 985 + ] + }, + { + "type": "String", + "value": "'function'", + "loc": { + "start": { + "line": 36, + "column": 21 + }, + "end": { + "line": 36, + "column": 31 + } + }, + "range": [ + 985, + 995 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 36, + "column": 31 + }, + "end": { + "line": 36, + "column": 32 + } + }, + "range": [ + 995, + 996 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 36, + "column": 32 + }, + "end": { + "line": 36, + "column": 33 + } + }, + "range": [ + 996, + 997 + ] + }, + { + "type": "Identifier", + "value": "fnParam", + "loc": { + "start": { + "line": 36, + "column": 34 + }, + "end": { + "line": 36, + "column": 41 + } + }, + "range": [ + 998, + 1005 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 36, + "column": 41 + }, + "end": { + "line": 36, + "column": 42 + } + }, + "range": [ + 1005, + 1006 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 36, + "column": 42 + }, + "end": { + "line": 36, + "column": 43 + } + }, + "range": [ + 1006, + 1007 + ] + }, + { + "type": "String", + "value": "'parameter'", + "loc": { + "start": { + "line": 36, + "column": 44 + }, + "end": { + "line": 36, + "column": 55 + } + }, + "range": [ + 1008, + 1019 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 36, + "column": 55 + }, + "end": { + "line": 36, + "column": 56 + } + }, + "range": [ + 1019, + 1020 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 36, + "column": 56 + }, + "end": { + "line": 36, + "column": 57 + } + }, + "range": [ + 1020, + 1021 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 6 + } + }, + "range": [ + 1022, + 1028 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 7 + } + }, + "range": [ + 1028, + 1029 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 37, + "column": 7 + }, + "end": { + "line": 37, + "column": 19 + } + }, + "range": [ + 1029, + 1041 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 20 + } + }, + "range": [ + 1041, + 1042 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 21 + } + }, + "range": [ + 1042, + 1043 + ] + }, + { + "type": "String", + "value": "'generator function'", + "loc": { + "start": { + "line": 37, + "column": 21 + }, + "end": { + "line": 37, + "column": 41 + } + }, + "range": [ + 1043, + 1063 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 37, + "column": 41 + }, + "end": { + "line": 37, + "column": 42 + } + }, + "range": [ + 1063, + 1064 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 37, + "column": 42 + }, + "end": { + "line": 37, + "column": 43 + } + }, + "range": [ + 1064, + 1065 + ] + }, + { + "type": "Identifier", + "value": "gen", + "loc": { + "start": { + "line": 37, + "column": 44 + }, + "end": { + "line": 37, + "column": 47 + } + }, + "range": [ + 1066, + 1069 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 37, + "column": 47 + }, + "end": { + "line": 37, + "column": 48 + } + }, + "range": [ + 1069, + 1070 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 37, + "column": 48 + }, + "end": { + "line": 37, + "column": 49 + } + }, + "range": [ + 1070, + 1071 + ] + }, + { + "type": "String", + "value": "'body'", + "loc": { + "start": { + "line": 37, + "column": 50 + }, + "end": { + "line": 37, + "column": 56 + } + }, + "range": [ + 1072, + 1078 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 37, + "column": 56 + }, + "end": { + "line": 37, + "column": 57 + } + }, + "range": [ + 1078, + 1079 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 37, + "column": 57 + }, + "end": { + "line": 37, + "column": 58 + } + }, + "range": [ + 1079, + 1080 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 6 + } + }, + "range": [ + 1081, + 1087 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 38, + "column": 6 + }, + "end": { + "line": 38, + "column": 7 + } + }, + "range": [ + 1087, + 1088 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 19 + } + }, + "range": [ + 1088, + 1100 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 38, + "column": 19 + }, + "end": { + "line": 38, + "column": 20 + } + }, + "range": [ + 1100, + 1101 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 38, + "column": 20 + }, + "end": { + "line": 38, + "column": 21 + } + }, + "range": [ + 1101, + 1102 + ] + }, + { + "type": "String", + "value": "'generator function'", + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 41 + } + }, + "range": [ + 1102, + 1122 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 38, + "column": 41 + }, + "end": { + "line": 38, + "column": 42 + } + }, + "range": [ + 1122, + 1123 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 38, + "column": 42 + }, + "end": { + "line": 38, + "column": 43 + } + }, + "range": [ + 1123, + 1124 + ] + }, + { + "type": "Identifier", + "value": "genParam", + "loc": { + "start": { + "line": 38, + "column": 44 + }, + "end": { + "line": 38, + "column": 52 + } + }, + "range": [ + 1125, + 1133 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 38, + "column": 52 + }, + "end": { + "line": 38, + "column": 53 + } + }, + "range": [ + 1133, + 1134 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 38, + "column": 53 + }, + "end": { + "line": 38, + "column": 54 + } + }, + "range": [ + 1134, + 1135 + ] + }, + { + "type": "String", + "value": "'parameter'", + "loc": { + "start": { + "line": 38, + "column": 55 + }, + "end": { + "line": 38, + "column": 66 + } + }, + "range": [ + 1136, + 1147 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 38, + "column": 66 + }, + "end": { + "line": 38, + "column": 67 + } + }, + "range": [ + 1147, + 1148 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 38, + "column": 67 + }, + "end": { + "line": 38, + "column": 68 + } + }, + "range": [ + 1148, + 1149 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 39, + "column": 0 + }, + "end": { + "line": 39, + "column": 6 + } + }, + "range": [ + 1150, + 1156 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 7 + } + }, + "range": [ + 1156, + 1157 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 39, + "column": 7 + }, + "end": { + "line": 39, + "column": 19 + } + }, + "range": [ + 1157, + 1169 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 39, + "column": 19 + }, + "end": { + "line": 39, + "column": 20 + } + }, + "range": [ + 1169, + 1170 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 39, + "column": 20 + }, + "end": { + "line": 39, + "column": 21 + } + }, + "range": [ + 1170, + 1171 + ] + }, + { + "type": "String", + "value": "'async function'", + "loc": { + "start": { + "line": 39, + "column": 21 + }, + "end": { + "line": 39, + "column": 37 + } + }, + "range": [ + 1171, + 1187 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 39, + "column": 37 + }, + "end": { + "line": 39, + "column": 38 + } + }, + "range": [ + 1187, + 1188 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 39, + "column": 38 + }, + "end": { + "line": 39, + "column": 39 + } + }, + "range": [ + 1188, + 1189 + ] + }, + { + "type": "Identifier", + "value": "asyncFn", + "loc": { + "start": { + "line": 39, + "column": 40 + }, + "end": { + "line": 39, + "column": 47 + } + }, + "range": [ + 1190, + 1197 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 39, + "column": 47 + }, + "end": { + "line": 39, + "column": 48 + } + }, + "range": [ + 1197, + 1198 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 39, + "column": 48 + }, + "end": { + "line": 39, + "column": 49 + } + }, + "range": [ + 1198, + 1199 + ] + }, + { + "type": "String", + "value": "'body'", + "loc": { + "start": { + "line": 39, + "column": 50 + }, + "end": { + "line": 39, + "column": 56 + } + }, + "range": [ + 1200, + 1206 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 39, + "column": 56 + }, + "end": { + "line": 39, + "column": 57 + } + }, + "range": [ + 1206, + 1207 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 39, + "column": 57 + }, + "end": { + "line": 39, + "column": 58 + } + }, + "range": [ + 1207, + 1208 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 40, + "column": 0 + }, + "end": { + "line": 40, + "column": 6 + } + }, + "range": [ + 1209, + 1215 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 40, + "column": 6 + }, + "end": { + "line": 40, + "column": 7 + } + }, + "range": [ + 1215, + 1216 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 40, + "column": 7 + }, + "end": { + "line": 40, + "column": 19 + } + }, + "range": [ + 1216, + 1228 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 40, + "column": 19 + }, + "end": { + "line": 40, + "column": 20 + } + }, + "range": [ + 1228, + 1229 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 40, + "column": 20 + }, + "end": { + "line": 40, + "column": 21 + } + }, + "range": [ + 1229, + 1230 + ] + }, + { + "type": "String", + "value": "'async function'", + "loc": { + "start": { + "line": 40, + "column": 21 + }, + "end": { + "line": 40, + "column": 37 + } + }, + "range": [ + 1230, + 1246 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 40, + "column": 37 + }, + "end": { + "line": 40, + "column": 38 + } + }, + "range": [ + 1246, + 1247 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 40, + "column": 38 + }, + "end": { + "line": 40, + "column": 39 + } + }, + "range": [ + 1247, + 1248 + ] + }, + { + "type": "Identifier", + "value": "asyncFnParam", + "loc": { + "start": { + "line": 40, + "column": 40 + }, + "end": { + "line": 40, + "column": 52 + } + }, + "range": [ + 1249, + 1261 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 40, + "column": 52 + }, + "end": { + "line": 40, + "column": 53 + } + }, + "range": [ + 1261, + 1262 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 40, + "column": 53 + }, + "end": { + "line": 40, + "column": 54 + } + }, + "range": [ + 1262, + 1263 + ] + }, + { + "type": "String", + "value": "'parameter'", + "loc": { + "start": { + "line": 40, + "column": 55 + }, + "end": { + "line": 40, + "column": 66 + } + }, + "range": [ + 1264, + 1275 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 40, + "column": 66 + }, + "end": { + "line": 40, + "column": 67 + } + }, + "range": [ + 1275, + 1276 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 40, + "column": 67 + }, + "end": { + "line": 40, + "column": 68 + } + }, + "range": [ + 1276, + 1277 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-functions.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-functions.src.js new file mode 100644 index 00000000..19aefb22 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-functions.src.js @@ -0,0 +1,40 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The identifier `arguments` is not restricted within function forms +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if ContainsArguments of ClassStaticBlockStatementList + is true. +includes: [compareArray.js] +features: [class-static-block] +---*/ + +var fn, fnParam; +var gen, genParam; +var asyncFn, asyncFnParam; + +class C { + static { + (function({test262 = fnParam = arguments}) { + fn = arguments; + })('function'); + + (function * ({test262 = genParam = arguments}) { + gen = arguments; + })('generator function').next(); + + (async function ({test262 = asyncFnParam = arguments}) { + asyncFn = arguments; + })('async function'); + } +} + +assert(compareArray(['function'], fn), 'body'); +assert(compareArray(['function'], fnParam), 'parameter'); +assert(compareArray(['generator function'], gen), 'body'); +assert(compareArray(['generator function'], genParam), 'parameter'); +assert(compareArray(['async function'], asyncFn), 'body'); +assert(compareArray(['async function'], asyncFnParam), 'parameter'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-methods.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-methods.result.js new file mode 100644 index 00000000..94399d31 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-methods.result.js @@ -0,0 +1,9111 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 58, + "column": 70 + } + }, + "range": [ + 502, + 1824 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 502, + 515 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 12 + } + }, + "range": [ + 506, + 514 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 12 + } + }, + "range": [ + 506, + 514 + ], + "name": "instance" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 516, + 540 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 520, + 526 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 520, + 526 + ], + "name": "method" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 528, + 539 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 528, + 539 + ], + "name": "methodParam" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 11 + } + }, + "range": [ + 541, + 552 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 10 + } + }, + "range": [ + 545, + 551 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 10 + } + }, + "range": [ + 545, + 551 + ], + "name": "getter" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 24 + } + }, + "range": [ + 553, + 577 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 557, + 563 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 557, + 563 + ], + "name": "setter" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 23 + } + }, + "range": [ + 565, + 576 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 23 + } + }, + "range": [ + 565, + 576 + ], + "name": "setterParam" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 30 + } + }, + "range": [ + 578, + 608 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 13 + } + }, + "range": [ + 582, + 591 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 13 + } + }, + "range": [ + 582, + 591 + ], + "name": "genMethod" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 29 + } + }, + "range": [ + 593, + 607 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 29 + } + }, + "range": [ + 593, + 607 + ], + "name": "genMethodParam" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 34 + } + }, + "range": [ + 609, + 643 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 613, + 624 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 613, + 624 + ], + "name": "asyncMethod" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 33 + } + }, + "range": [ + 626, + 642 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 33 + } + }, + "range": [ + 626, + 642 + ], + "name": "asyncMethodParam" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 42, + "column": 1 + } + }, + "range": [ + 645, + 1143 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 651, + 652 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 42, + "column": 1 + } + }, + "range": [ + 653, + 1143 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 41, + "column": 3 + } + }, + "range": [ + 657, + 1141 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 40, + "column": 8 + } + }, + "range": [ + 670, + 1137 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 40, + "column": 7 + } + }, + "range": [ + 670, + 1136 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 12 + } + }, + "range": [ + 670, + 678 + ], + "name": "instance" + }, + "right": { + "type": "NewExpression", + "loc": { + "start": { + "line": 24, + "column": 15 + }, + "end": { + "line": 40, + "column": 7 + } + }, + "range": [ + 681, + 1136 + ], + "callee": { + "type": "ClassExpression", + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 40, + "column": 5 + } + }, + "range": [ + 685, + 1134 + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 24, + "column": 25 + }, + "end": { + "line": 40, + "column": 5 + } + }, + "range": [ + 691, + 1134 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 699, + 780 + ], + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 12 + } + }, + "range": [ + 699, + 705 + ], + "name": "method" + }, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 25, + "column": 12 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 705, + 780 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 706, + 741 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 47 + } + }, + "range": [ + 707, + 740 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 707, + 714 + ], + "name": "test262" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 47 + } + }, + "range": [ + 707, + 740 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 707, + 714 + ], + "name": "test262" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 25, + "column": 24 + }, + "end": { + "line": 25, + "column": 47 + } + }, + "range": [ + 717, + 740 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 24 + }, + "end": { + "line": 25, + "column": 35 + } + }, + "range": [ + 717, + 728 + ], + "name": "methodParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 38 + }, + "end": { + "line": 25, + "column": 47 + } + }, + "range": [ + 731, + 740 + ], + "name": "arguments" + } + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 25, + "column": 50 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 743, + 780 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "range": [ + 753, + 772 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "range": [ + 753, + 771 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 14 + } + }, + "range": [ + 753, + 759 + ], + "name": "method" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "range": [ + 762, + 771 + ], + "name": "arguments" + } + } + } + ] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 28, + "column": 6 + }, + "end": { + "line": 30, + "column": 7 + } + }, + "range": [ + 787, + 839 + ], + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 28, + "column": 10 + }, + "end": { + "line": 28, + "column": 18 + } + }, + "range": [ + 791, + 799 + ], + "name": "accessor" + }, + "kind": "get", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 28, + "column": 18 + }, + "end": { + "line": 30, + "column": 7 + } + }, + "range": [ + 799, + 839 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 28, + "column": 21 + }, + "end": { + "line": 30, + "column": 7 + } + }, + "range": [ + 802, + 839 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 27 + } + }, + "range": [ + 812, + 831 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "range": [ + 812, + 830 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 14 + } + }, + "range": [ + 812, + 818 + ], + "name": "getter" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 17 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "range": [ + 821, + 830 + ], + "name": "arguments" + } + } + } + ] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 33, + "column": 7 + } + }, + "range": [ + 846, + 933 + ], + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 18 + } + }, + "range": [ + 850, + 858 + ], + "name": "accessor" + }, + "kind": "set", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 31, + "column": 18 + }, + "end": { + "line": 33, + "column": 7 + } + }, + "range": [ + 858, + 933 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 31, + "column": 54 + } + }, + "range": [ + 859, + 894 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 31, + "column": 20 + }, + "end": { + "line": 31, + "column": 53 + } + }, + "range": [ + 860, + 893 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 20 + }, + "end": { + "line": 31, + "column": 27 + } + }, + "range": [ + 860, + 867 + ], + "name": "test262" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 31, + "column": 20 + }, + "end": { + "line": 31, + "column": 53 + } + }, + "range": [ + 860, + 893 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 20 + }, + "end": { + "line": 31, + "column": 27 + } + }, + "range": [ + 860, + 867 + ], + "name": "test262" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 31, + "column": 30 + }, + "end": { + "line": 31, + "column": 53 + } + }, + "range": [ + 870, + 893 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 30 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "range": [ + 870, + 881 + ], + "name": "setterParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 44 + }, + "end": { + "line": 31, + "column": 53 + } + }, + "range": [ + 884, + 893 + ], + "name": "arguments" + } + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 31, + "column": 56 + }, + "end": { + "line": 33, + "column": 7 + } + }, + "range": [ + 896, + 933 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 27 + } + }, + "range": [ + 906, + 925 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 26 + } + }, + "range": [ + 906, + 924 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 14 + } + }, + "range": [ + 906, + 912 + ], + "name": "setter" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 26 + } + }, + "range": [ + 915, + 924 + ], + "name": "arguments" + } + } + } + ] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 34, + "column": 6 + }, + "end": { + "line": 36, + "column": 7 + } + }, + "range": [ + 940, + 1025 + ], + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 34, + "column": 7 + }, + "end": { + "line": 34, + "column": 10 + } + }, + "range": [ + 941, + 944 + ], + "name": "gen" + }, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 34, + "column": 10 + }, + "end": { + "line": 36, + "column": 7 + } + }, + "range": [ + 944, + 1025 + ], + "id": null, + "expression": false, + "generator": true, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 49 + } + }, + "range": [ + 945, + 983 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 48 + } + }, + "range": [ + 946, + 982 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 19 + } + }, + "range": [ + 946, + 953 + ], + "name": "test262" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 48 + } + }, + "range": [ + 946, + 982 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 19 + } + }, + "range": [ + 946, + 953 + ], + "name": "test262" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 34, + "column": 22 + }, + "end": { + "line": 34, + "column": 48 + } + }, + "range": [ + 956, + 982 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 34, + "column": 22 + }, + "end": { + "line": 34, + "column": 36 + } + }, + "range": [ + 956, + 970 + ], + "name": "genMethodParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 34, + "column": 39 + }, + "end": { + "line": 34, + "column": 48 + } + }, + "range": [ + 973, + 982 + ], + "name": "arguments" + } + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 34, + "column": 51 + }, + "end": { + "line": 36, + "column": 7 + } + }, + "range": [ + 985, + 1025 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 30 + } + }, + "range": [ + 995, + 1017 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 29 + } + }, + "range": [ + 995, + 1016 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 17 + } + }, + "range": [ + 995, + 1004 + ], + "name": "genMethod" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 35, + "column": 20 + }, + "end": { + "line": 35, + "column": 29 + } + }, + "range": [ + 1007, + 1016 + ], + "name": "arguments" + } + } + } + ] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 39, + "column": 7 + } + }, + "range": [ + 1032, + 1128 + ], + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 17 + } + }, + "range": [ + 1038, + 1043 + ], + "name": "async" + }, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 39, + "column": 7 + } + }, + "range": [ + 1043, + 1128 + ], + "id": null, + "expression": false, + "generator": false, + "async": true, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 37, + "column": 18 + }, + "end": { + "line": 37, + "column": 58 + } + }, + "range": [ + 1044, + 1084 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 57 + } + }, + "range": [ + 1045, + 1083 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 26 + } + }, + "range": [ + 1045, + 1052 + ], + "name": "test262" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 57 + } + }, + "range": [ + 1045, + 1083 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 26 + } + }, + "range": [ + 1045, + 1052 + ], + "name": "test262" + }, + "right": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 37, + "column": 29 + }, + "end": { + "line": 37, + "column": 57 + } + }, + "range": [ + 1055, + 1083 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 29 + }, + "end": { + "line": 37, + "column": 45 + } + }, + "range": [ + 1055, + 1071 + ], + "name": "asyncMethodParam" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 48 + }, + "end": { + "line": 37, + "column": 57 + } + }, + "range": [ + 1074, + 1083 + ], + "name": "arguments" + } + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 37, + "column": 60 + }, + "end": { + "line": 39, + "column": 7 + } + }, + "range": [ + 1086, + 1128 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 32 + } + }, + "range": [ + 1096, + 1120 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 31 + } + }, + "range": [ + 1096, + 1119 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 19 + } + }, + "range": [ + 1096, + 1107 + ], + "name": "asyncMethod" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 38, + "column": 22 + }, + "end": { + "line": 38, + "column": 31 + } + }, + "range": [ + 1110, + 1119 + ], + "name": "arguments" + } + } + } + ] + } + } + } + ] + } + }, + "arguments": [] + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 26 + } + }, + "range": [ + 1145, + 1171 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 25 + } + }, + "range": [ + 1145, + 1170 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 15 + } + }, + "range": [ + 1145, + 1160 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 8 + } + }, + "range": [ + 1145, + 1153 + ], + "name": "instance" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 44, + "column": 9 + }, + "end": { + "line": 44, + "column": 15 + } + }, + "range": [ + 1154, + 1160 + ], + "name": "method" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 44, + "column": 16 + }, + "end": { + "line": 44, + "column": 24 + } + }, + "range": [ + 1161, + 1169 + ], + "value": "method", + "raw": "'method'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 18 + } + }, + "range": [ + 1172, + 1190 + ], + "expression": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 17 + } + }, + "range": [ + 1172, + 1189 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 8 + } + }, + "range": [ + 1172, + 1180 + ], + "name": "instance" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 45, + "column": 9 + }, + "end": { + "line": 45, + "column": 17 + } + }, + "range": [ + 1181, + 1189 + ], + "name": "accessor" + }, + "computed": false, + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 29 + } + }, + "range": [ + 1191, + 1220 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 28 + } + }, + "range": [ + 1191, + 1219 + ], + "operator": "=", + "left": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 17 + } + }, + "range": [ + 1191, + 1208 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 8 + } + }, + "range": [ + 1191, + 1199 + ], + "name": "instance" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 17 + } + }, + "range": [ + 1200, + 1208 + ], + "name": "accessor" + }, + "computed": false, + "optional": false + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 46, + "column": 20 + }, + "end": { + "line": 46, + "column": 28 + } + }, + "range": [ + 1211, + 1219 + ], + "value": "setter", + "raw": "'setter'" + } + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 47, + "column": 0 + }, + "end": { + "line": 47, + "column": 40 + } + }, + "range": [ + 1221, + 1261 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 47, + "column": 0 + }, + "end": { + "line": 47, + "column": 39 + } + }, + "range": [ + 1221, + 1260 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 47, + "column": 0 + }, + "end": { + "line": 47, + "column": 37 + } + }, + "range": [ + 1221, + 1258 + ], + "object": { + "type": "CallExpression", + "loc": { + "start": { + "line": 47, + "column": 0 + }, + "end": { + "line": 47, + "column": 32 + } + }, + "range": [ + 1221, + 1253 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 47, + "column": 0 + }, + "end": { + "line": 47, + "column": 12 + } + }, + "range": [ + 1221, + 1233 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 47, + "column": 0 + }, + "end": { + "line": 47, + "column": 8 + } + }, + "range": [ + 1221, + 1229 + ], + "name": "instance" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 12 + } + }, + "range": [ + 1230, + 1233 + ], + "name": "gen" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 47, + "column": 13 + }, + "end": { + "line": 47, + "column": 31 + } + }, + "range": [ + 1234, + 1252 + ], + "value": "generator method", + "raw": "'generator method'" + } + ], + "optional": false + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 47, + "column": 33 + }, + "end": { + "line": 47, + "column": 37 + } + }, + "range": [ + 1254, + 1258 + ], + "name": "next" + }, + "computed": false, + "optional": false + }, + "arguments": [], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 31 + } + }, + "range": [ + 1262, + 1293 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 30 + } + }, + "range": [ + 1262, + 1292 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 14 + } + }, + "range": [ + 1262, + 1276 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 8 + } + }, + "range": [ + 1262, + 1270 + ], + "name": "instance" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 14 + } + }, + "range": [ + 1271, + 1276 + ], + "name": "async" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 29 + } + }, + "range": [ + 1277, + 1291 + ], + "value": "async method", + "raw": "'async method'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 50, + "column": 0 + }, + "end": { + "line": 50, + "column": 49 + } + }, + "range": [ + 1295, + 1344 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 50, + "column": 0 + }, + "end": { + "line": 50, + "column": 48 + } + }, + "range": [ + 1295, + 1343 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 50, + "column": 0 + }, + "end": { + "line": 50, + "column": 6 + } + }, + "range": [ + 1295, + 1301 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 50, + "column": 7 + }, + "end": { + "line": 50, + "column": 39 + } + }, + "range": [ + 1302, + 1334 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 50, + "column": 7 + }, + "end": { + "line": 50, + "column": 19 + } + }, + "range": [ + 1302, + 1314 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 50, + "column": 20 + }, + "end": { + "line": 50, + "column": 30 + } + }, + "range": [ + 1315, + 1325 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 50, + "column": 21 + }, + "end": { + "line": 50, + "column": 29 + } + }, + "range": [ + 1316, + 1324 + ], + "value": "method", + "raw": "'method'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 50, + "column": 32 + }, + "end": { + "line": 50, + "column": 38 + } + }, + "range": [ + 1327, + 1333 + ], + "name": "method" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 50, + "column": 41 + }, + "end": { + "line": 50, + "column": 47 + } + }, + "range": [ + 1336, + 1342 + ], + "value": "body", + "raw": "'body'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 59 + } + }, + "range": [ + 1345, + 1404 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 58 + } + }, + "range": [ + 1345, + 1403 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 6 + } + }, + "range": [ + 1345, + 1351 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 51, + "column": 7 + }, + "end": { + "line": 51, + "column": 44 + } + }, + "range": [ + 1352, + 1389 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 51, + "column": 7 + }, + "end": { + "line": 51, + "column": 19 + } + }, + "range": [ + 1352, + 1364 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 51, + "column": 20 + }, + "end": { + "line": 51, + "column": 30 + } + }, + "range": [ + 1365, + 1375 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 51, + "column": 21 + }, + "end": { + "line": 51, + "column": 29 + } + }, + "range": [ + 1366, + 1374 + ], + "value": "method", + "raw": "'method'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 51, + "column": 32 + }, + "end": { + "line": 51, + "column": 43 + } + }, + "range": [ + 1377, + 1388 + ], + "name": "methodParam" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 51, + "column": 46 + }, + "end": { + "line": 51, + "column": 57 + } + }, + "range": [ + 1391, + 1402 + ], + "value": "parameter", + "raw": "'parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 41 + } + }, + "range": [ + 1405, + 1446 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 40 + } + }, + "range": [ + 1405, + 1445 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 6 + } + }, + "range": [ + 1405, + 1411 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 52, + "column": 7 + }, + "end": { + "line": 52, + "column": 31 + } + }, + "range": [ + 1412, + 1436 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 52, + "column": 7 + }, + "end": { + "line": 52, + "column": 19 + } + }, + "range": [ + 1412, + 1424 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 52, + "column": 20 + }, + "end": { + "line": 52, + "column": 22 + } + }, + "range": [ + 1425, + 1427 + ], + "elements": [] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 52, + "column": 24 + }, + "end": { + "line": 52, + "column": 30 + } + }, + "range": [ + 1429, + 1435 + ], + "name": "getter" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 52, + "column": 33 + }, + "end": { + "line": 52, + "column": 39 + } + }, + "range": [ + 1438, + 1444 + ], + "value": "body", + "raw": "'body'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 53, + "column": 0 + }, + "end": { + "line": 53, + "column": 49 + } + }, + "range": [ + 1447, + 1496 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 53, + "column": 0 + }, + "end": { + "line": 53, + "column": 48 + } + }, + "range": [ + 1447, + 1495 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 53, + "column": 0 + }, + "end": { + "line": 53, + "column": 6 + } + }, + "range": [ + 1447, + 1453 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 53, + "column": 7 + }, + "end": { + "line": 53, + "column": 39 + } + }, + "range": [ + 1454, + 1486 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 53, + "column": 7 + }, + "end": { + "line": 53, + "column": 19 + } + }, + "range": [ + 1454, + 1466 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 53, + "column": 20 + }, + "end": { + "line": 53, + "column": 30 + } + }, + "range": [ + 1467, + 1477 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 53, + "column": 21 + }, + "end": { + "line": 53, + "column": 29 + } + }, + "range": [ + 1468, + 1476 + ], + "value": "setter", + "raw": "'setter'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 53, + "column": 32 + }, + "end": { + "line": 53, + "column": 38 + } + }, + "range": [ + 1479, + 1485 + ], + "name": "setter" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 53, + "column": 41 + }, + "end": { + "line": 53, + "column": 47 + } + }, + "range": [ + 1488, + 1494 + ], + "value": "body", + "raw": "'body'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 54, + "column": 0 + }, + "end": { + "line": 54, + "column": 59 + } + }, + "range": [ + 1497, + 1556 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 54, + "column": 0 + }, + "end": { + "line": 54, + "column": 58 + } + }, + "range": [ + 1497, + 1555 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 54, + "column": 0 + }, + "end": { + "line": 54, + "column": 6 + } + }, + "range": [ + 1497, + 1503 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 54, + "column": 7 + }, + "end": { + "line": 54, + "column": 44 + } + }, + "range": [ + 1504, + 1541 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 54, + "column": 7 + }, + "end": { + "line": 54, + "column": 19 + } + }, + "range": [ + 1504, + 1516 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 54, + "column": 20 + }, + "end": { + "line": 54, + "column": 30 + } + }, + "range": [ + 1517, + 1527 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 54, + "column": 21 + }, + "end": { + "line": 54, + "column": 29 + } + }, + "range": [ + 1518, + 1526 + ], + "value": "setter", + "raw": "'setter'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 54, + "column": 32 + }, + "end": { + "line": 54, + "column": 43 + } + }, + "range": [ + 1529, + 1540 + ], + "name": "setterParam" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 54, + "column": 46 + }, + "end": { + "line": 54, + "column": 57 + } + }, + "range": [ + 1543, + 1554 + ], + "value": "parameter", + "raw": "'parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 55, + "column": 0 + }, + "end": { + "line": 55, + "column": 62 + } + }, + "range": [ + 1557, + 1619 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 55, + "column": 0 + }, + "end": { + "line": 55, + "column": 61 + } + }, + "range": [ + 1557, + 1618 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 55, + "column": 0 + }, + "end": { + "line": 55, + "column": 6 + } + }, + "range": [ + 1557, + 1563 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 55, + "column": 7 + }, + "end": { + "line": 55, + "column": 52 + } + }, + "range": [ + 1564, + 1609 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 55, + "column": 7 + }, + "end": { + "line": 55, + "column": 19 + } + }, + "range": [ + 1564, + 1576 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 55, + "column": 20 + }, + "end": { + "line": 55, + "column": 40 + } + }, + "range": [ + 1577, + 1597 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 55, + "column": 21 + }, + "end": { + "line": 55, + "column": 39 + } + }, + "range": [ + 1578, + 1596 + ], + "value": "generator method", + "raw": "'generator method'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 55, + "column": 42 + }, + "end": { + "line": 55, + "column": 51 + } + }, + "range": [ + 1599, + 1608 + ], + "name": "genMethod" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 55, + "column": 54 + }, + "end": { + "line": 55, + "column": 60 + } + }, + "range": [ + 1611, + 1617 + ], + "value": "body", + "raw": "'body'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 56, + "column": 0 + }, + "end": { + "line": 56, + "column": 72 + } + }, + "range": [ + 1620, + 1692 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 56, + "column": 0 + }, + "end": { + "line": 56, + "column": 71 + } + }, + "range": [ + 1620, + 1691 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 56, + "column": 0 + }, + "end": { + "line": 56, + "column": 6 + } + }, + "range": [ + 1620, + 1626 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 56, + "column": 7 + }, + "end": { + "line": 56, + "column": 57 + } + }, + "range": [ + 1627, + 1677 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 56, + "column": 7 + }, + "end": { + "line": 56, + "column": 19 + } + }, + "range": [ + 1627, + 1639 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 56, + "column": 20 + }, + "end": { + "line": 56, + "column": 40 + } + }, + "range": [ + 1640, + 1660 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 56, + "column": 21 + }, + "end": { + "line": 56, + "column": 39 + } + }, + "range": [ + 1641, + 1659 + ], + "value": "generator method", + "raw": "'generator method'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 56, + "column": 42 + }, + "end": { + "line": 56, + "column": 56 + } + }, + "range": [ + 1662, + 1676 + ], + "name": "genMethodParam" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 56, + "column": 59 + }, + "end": { + "line": 56, + "column": 70 + } + }, + "range": [ + 1679, + 1690 + ], + "value": "parameter", + "raw": "'parameter'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 57, + "column": 0 + }, + "end": { + "line": 57, + "column": 60 + } + }, + "range": [ + 1693, + 1753 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 57, + "column": 0 + }, + "end": { + "line": 57, + "column": 59 + } + }, + "range": [ + 1693, + 1752 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 57, + "column": 0 + }, + "end": { + "line": 57, + "column": 6 + } + }, + "range": [ + 1693, + 1699 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 57, + "column": 7 + }, + "end": { + "line": 57, + "column": 50 + } + }, + "range": [ + 1700, + 1743 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 57, + "column": 7 + }, + "end": { + "line": 57, + "column": 19 + } + }, + "range": [ + 1700, + 1712 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 57, + "column": 20 + }, + "end": { + "line": 57, + "column": 36 + } + }, + "range": [ + 1713, + 1729 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 57, + "column": 21 + }, + "end": { + "line": 57, + "column": 35 + } + }, + "range": [ + 1714, + 1728 + ], + "value": "async method", + "raw": "'async method'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 57, + "column": 38 + }, + "end": { + "line": 57, + "column": 49 + } + }, + "range": [ + 1731, + 1742 + ], + "name": "asyncMethod" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 57, + "column": 52 + }, + "end": { + "line": 57, + "column": 58 + } + }, + "range": [ + 1745, + 1751 + ], + "value": "body", + "raw": "'body'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 58, + "column": 0 + }, + "end": { + "line": 58, + "column": 70 + } + }, + "range": [ + 1754, + 1824 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 58, + "column": 0 + }, + "end": { + "line": 58, + "column": 69 + } + }, + "range": [ + 1754, + 1823 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 58, + "column": 0 + }, + "end": { + "line": 58, + "column": 6 + } + }, + "range": [ + 1754, + 1760 + ], + "name": "assert" + }, + "arguments": [ + { + "type": "CallExpression", + "loc": { + "start": { + "line": 58, + "column": 7 + }, + "end": { + "line": 58, + "column": 55 + } + }, + "range": [ + 1761, + 1809 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 58, + "column": 7 + }, + "end": { + "line": 58, + "column": 19 + } + }, + "range": [ + 1761, + 1773 + ], + "name": "compareArray" + }, + "arguments": [ + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 58, + "column": 20 + }, + "end": { + "line": 58, + "column": 36 + } + }, + "range": [ + 1774, + 1790 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 58, + "column": 21 + }, + "end": { + "line": 58, + "column": 35 + } + }, + "range": [ + 1775, + 1789 + ], + "value": "async method", + "raw": "'async method'" + } + ] + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 58, + "column": 38 + }, + "end": { + "line": 58, + "column": 54 + } + }, + "range": [ + 1792, + 1808 + ], + "name": "asyncMethodParam" + } + ], + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 58, + "column": 57 + }, + "end": { + "line": 58, + "column": 68 + } + }, + "range": [ + 1811, + 1822 + ], + "value": "parameter", + "raw": "'parameter'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 502, + 505 + ] + }, + { + "type": "Identifier", + "value": "instance", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 12 + } + }, + "range": [ + 506, + 514 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 514, + 515 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 3 + } + }, + "range": [ + 516, + 519 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 520, + 526 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 11 + } + }, + "range": [ + 526, + 527 + ] + }, + { + "type": "Identifier", + "value": "methodParam", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 528, + 539 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 539, + 540 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 541, + 544 + ] + }, + { + "type": "Identifier", + "value": "getter", + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 10 + } + }, + "range": [ + 545, + 551 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 11 + } + }, + "range": [ + 551, + 552 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + }, + "range": [ + 553, + 556 + ] + }, + { + "type": "Identifier", + "value": "setter", + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 557, + 563 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + }, + "range": [ + 563, + 564 + ] + }, + { + "type": "Identifier", + "value": "setterParam", + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 23 + } + }, + "range": [ + 565, + 576 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + }, + "range": [ + 576, + 577 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + }, + "range": [ + 578, + 581 + ] + }, + { + "type": "Identifier", + "value": "genMethod", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 13 + } + }, + "range": [ + 582, + 591 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 19, + "column": 13 + }, + "end": { + "line": 19, + "column": 14 + } + }, + "range": [ + 591, + 592 + ] + }, + { + "type": "Identifier", + "value": "genMethodParam", + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 29 + } + }, + "range": [ + 593, + 607 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 19, + "column": 29 + }, + "end": { + "line": 19, + "column": 30 + } + }, + "range": [ + 607, + 608 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + }, + "range": [ + 609, + 612 + ] + }, + { + "type": "Identifier", + "value": "asyncMethod", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 613, + 624 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 16 + } + }, + "range": [ + 624, + 625 + ] + }, + { + "type": "Identifier", + "value": "asyncMethodParam", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 33 + } + }, + "range": [ + 626, + 642 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 20, + "column": 34 + } + }, + "range": [ + 642, + 643 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 5 + } + }, + "range": [ + 645, + 650 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 7 + } + }, + "range": [ + 651, + 652 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + }, + "range": [ + 653, + 654 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 8 + } + }, + "range": [ + 657, + 663 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 10 + } + }, + "range": [ + 664, + 665 + ] + }, + { + "type": "Identifier", + "value": "instance", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 12 + } + }, + "range": [ + 670, + 678 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 24, + "column": 13 + }, + "end": { + "line": 24, + "column": 14 + } + }, + "range": [ + 679, + 680 + ] + }, + { + "type": "Keyword", + "value": "new", + "loc": { + "start": { + "line": 24, + "column": 15 + }, + "end": { + "line": 24, + "column": 18 + } + }, + "range": [ + 681, + 684 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 24 + } + }, + "range": [ + 685, + 690 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 24, + "column": 25 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "range": [ + 691, + 692 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 12 + } + }, + "range": [ + 699, + 705 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 25, + "column": 12 + }, + "end": { + "line": 25, + "column": 13 + } + }, + "range": [ + 705, + 706 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 14 + } + }, + "range": [ + 706, + 707 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 707, + 714 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 23 + } + }, + "range": [ + 715, + 716 + ] + }, + { + "type": "Identifier", + "value": "methodParam", + "loc": { + "start": { + "line": 25, + "column": 24 + }, + "end": { + "line": 25, + "column": 35 + } + }, + "range": [ + 717, + 728 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 25, + "column": 36 + }, + "end": { + "line": 25, + "column": 37 + } + }, + "range": [ + 729, + 730 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 25, + "column": 38 + }, + "end": { + "line": 25, + "column": 47 + } + }, + "range": [ + 731, + 740 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 25, + "column": 47 + }, + "end": { + "line": 25, + "column": 48 + } + }, + "range": [ + 740, + 741 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 25, + "column": 48 + }, + "end": { + "line": 25, + "column": 49 + } + }, + "range": [ + 741, + 742 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 25, + "column": 50 + }, + "end": { + "line": 25, + "column": 51 + } + }, + "range": [ + 743, + 744 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 14 + } + }, + "range": [ + 753, + 759 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "range": [ + 760, + 761 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "range": [ + 762, + 771 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "range": [ + 771, + 772 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 779, + 780 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 28, + "column": 6 + }, + "end": { + "line": 28, + "column": 9 + } + }, + "range": [ + 787, + 790 + ] + }, + { + "type": "Identifier", + "value": "accessor", + "loc": { + "start": { + "line": 28, + "column": 10 + }, + "end": { + "line": 28, + "column": 18 + } + }, + "range": [ + 791, + 799 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 28, + "column": 18 + }, + "end": { + "line": 28, + "column": 19 + } + }, + "range": [ + 799, + 800 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 28, + "column": 19 + }, + "end": { + "line": 28, + "column": 20 + } + }, + "range": [ + 800, + 801 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 28, + "column": 21 + }, + "end": { + "line": 28, + "column": 22 + } + }, + "range": [ + 802, + 803 + ] + }, + { + "type": "Identifier", + "value": "getter", + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 14 + } + }, + "range": [ + 812, + 818 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 16 + } + }, + "range": [ + 819, + 820 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 29, + "column": 17 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "range": [ + 821, + 830 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 29, + "column": 26 + }, + "end": { + "line": 29, + "column": 27 + } + }, + "range": [ + 830, + 831 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 30, + "column": 6 + }, + "end": { + "line": 30, + "column": 7 + } + }, + "range": [ + 838, + 839 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 9 + } + }, + "range": [ + 846, + 849 + ] + }, + { + "type": "Identifier", + "value": "accessor", + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 18 + } + }, + "range": [ + 850, + 858 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 31, + "column": 18 + }, + "end": { + "line": 31, + "column": 19 + } + }, + "range": [ + 858, + 859 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 31, + "column": 20 + } + }, + "range": [ + 859, + 860 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 31, + "column": 20 + }, + "end": { + "line": 31, + "column": 27 + } + }, + "range": [ + 860, + 867 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 31, + "column": 28 + }, + "end": { + "line": 31, + "column": 29 + } + }, + "range": [ + 868, + 869 + ] + }, + { + "type": "Identifier", + "value": "setterParam", + "loc": { + "start": { + "line": 31, + "column": 30 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "range": [ + 870, + 881 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 31, + "column": 42 + }, + "end": { + "line": 31, + "column": 43 + } + }, + "range": [ + 882, + 883 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 31, + "column": 44 + }, + "end": { + "line": 31, + "column": 53 + } + }, + "range": [ + 884, + 893 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 31, + "column": 53 + }, + "end": { + "line": 31, + "column": 54 + } + }, + "range": [ + 893, + 894 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 31, + "column": 54 + }, + "end": { + "line": 31, + "column": 55 + } + }, + "range": [ + 894, + 895 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 31, + "column": 56 + }, + "end": { + "line": 31, + "column": 57 + } + }, + "range": [ + 896, + 897 + ] + }, + { + "type": "Identifier", + "value": "setter", + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 14 + } + }, + "range": [ + 906, + 912 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 32, + "column": 15 + }, + "end": { + "line": 32, + "column": 16 + } + }, + "range": [ + 913, + 914 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 26 + } + }, + "range": [ + 915, + 924 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 32, + "column": 26 + }, + "end": { + "line": 32, + "column": 27 + } + }, + "range": [ + 924, + 925 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 33, + "column": 6 + }, + "end": { + "line": 33, + "column": 7 + } + }, + "range": [ + 932, + 933 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 34, + "column": 6 + }, + "end": { + "line": 34, + "column": 7 + } + }, + "range": [ + 940, + 941 + ] + }, + { + "type": "Identifier", + "value": "gen", + "loc": { + "start": { + "line": 34, + "column": 7 + }, + "end": { + "line": 34, + "column": 10 + } + }, + "range": [ + 941, + 944 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 34, + "column": 10 + }, + "end": { + "line": 34, + "column": 11 + } + }, + "range": [ + 944, + 945 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 12 + } + }, + "range": [ + 945, + 946 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 19 + } + }, + "range": [ + 946, + 953 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 34, + "column": 20 + }, + "end": { + "line": 34, + "column": 21 + } + }, + "range": [ + 954, + 955 + ] + }, + { + "type": "Identifier", + "value": "genMethodParam", + "loc": { + "start": { + "line": 34, + "column": 22 + }, + "end": { + "line": 34, + "column": 36 + } + }, + "range": [ + 956, + 970 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 34, + "column": 37 + }, + "end": { + "line": 34, + "column": 38 + } + }, + "range": [ + 971, + 972 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 34, + "column": 39 + }, + "end": { + "line": 34, + "column": 48 + } + }, + "range": [ + 973, + 982 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 34, + "column": 48 + }, + "end": { + "line": 34, + "column": 49 + } + }, + "range": [ + 982, + 983 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 34, + "column": 49 + }, + "end": { + "line": 34, + "column": 50 + } + }, + "range": [ + 983, + 984 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 34, + "column": 51 + }, + "end": { + "line": 34, + "column": 52 + } + }, + "range": [ + 985, + 986 + ] + }, + { + "type": "Identifier", + "value": "genMethod", + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 17 + } + }, + "range": [ + 995, + 1004 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 35, + "column": 18 + }, + "end": { + "line": 35, + "column": 19 + } + }, + "range": [ + 1005, + 1006 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 35, + "column": 20 + }, + "end": { + "line": 35, + "column": 29 + } + }, + "range": [ + 1007, + 1016 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 35, + "column": 29 + }, + "end": { + "line": 35, + "column": 30 + } + }, + "range": [ + 1016, + 1017 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 36, + "column": 6 + }, + "end": { + "line": 36, + "column": 7 + } + }, + "range": [ + 1024, + 1025 + ] + }, + { + "type": "Identifier", + "value": "async", + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 11 + } + }, + "range": [ + 1032, + 1037 + ] + }, + { + "type": "Identifier", + "value": "async", + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 17 + } + }, + "range": [ + 1038, + 1043 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 18 + } + }, + "range": [ + 1043, + 1044 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 37, + "column": 18 + }, + "end": { + "line": 37, + "column": 19 + } + }, + "range": [ + 1044, + 1045 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 26 + } + }, + "range": [ + 1045, + 1052 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 37, + "column": 27 + }, + "end": { + "line": 37, + "column": 28 + } + }, + "range": [ + 1053, + 1054 + ] + }, + { + "type": "Identifier", + "value": "asyncMethodParam", + "loc": { + "start": { + "line": 37, + "column": 29 + }, + "end": { + "line": 37, + "column": 45 + } + }, + "range": [ + 1055, + 1071 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 37, + "column": 46 + }, + "end": { + "line": 37, + "column": 47 + } + }, + "range": [ + 1072, + 1073 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 37, + "column": 48 + }, + "end": { + "line": 37, + "column": 57 + } + }, + "range": [ + 1074, + 1083 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 37, + "column": 57 + }, + "end": { + "line": 37, + "column": 58 + } + }, + "range": [ + 1083, + 1084 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 37, + "column": 58 + }, + "end": { + "line": 37, + "column": 59 + } + }, + "range": [ + 1084, + 1085 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 37, + "column": 60 + }, + "end": { + "line": 37, + "column": 61 + } + }, + "range": [ + 1086, + 1087 + ] + }, + { + "type": "Identifier", + "value": "asyncMethod", + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 19 + } + }, + "range": [ + 1096, + 1107 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 38, + "column": 20 + }, + "end": { + "line": 38, + "column": 21 + } + }, + "range": [ + 1108, + 1109 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 38, + "column": 22 + }, + "end": { + "line": 38, + "column": 31 + } + }, + "range": [ + 1110, + 1119 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 38, + "column": 31 + }, + "end": { + "line": 38, + "column": 32 + } + }, + "range": [ + 1119, + 1120 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 7 + } + }, + "range": [ + 1127, + 1128 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 40, + "column": 4 + }, + "end": { + "line": 40, + "column": 5 + } + }, + "range": [ + 1133, + 1134 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 40, + "column": 5 + }, + "end": { + "line": 40, + "column": 6 + } + }, + "range": [ + 1134, + 1135 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 40, + "column": 6 + }, + "end": { + "line": 40, + "column": 7 + } + }, + "range": [ + 1135, + 1136 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 40, + "column": 7 + }, + "end": { + "line": 40, + "column": 8 + } + }, + "range": [ + 1136, + 1137 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 3 + } + }, + "range": [ + 1140, + 1141 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 42, + "column": 0 + }, + "end": { + "line": 42, + "column": 1 + } + }, + "range": [ + 1142, + 1143 + ] + }, + { + "type": "Identifier", + "value": "instance", + "loc": { + "start": { + "line": 44, + "column": 0 + }, + "end": { + "line": 44, + "column": 8 + } + }, + "range": [ + 1145, + 1153 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 44, + "column": 8 + }, + "end": { + "line": 44, + "column": 9 + } + }, + "range": [ + 1153, + 1154 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 44, + "column": 9 + }, + "end": { + "line": 44, + "column": 15 + } + }, + "range": [ + 1154, + 1160 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 44, + "column": 15 + }, + "end": { + "line": 44, + "column": 16 + } + }, + "range": [ + 1160, + 1161 + ] + }, + { + "type": "String", + "value": "'method'", + "loc": { + "start": { + "line": 44, + "column": 16 + }, + "end": { + "line": 44, + "column": 24 + } + }, + "range": [ + 1161, + 1169 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 44, + "column": 24 + }, + "end": { + "line": 44, + "column": 25 + } + }, + "range": [ + 1169, + 1170 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 44, + "column": 25 + }, + "end": { + "line": 44, + "column": 26 + } + }, + "range": [ + 1170, + 1171 + ] + }, + { + "type": "Identifier", + "value": "instance", + "loc": { + "start": { + "line": 45, + "column": 0 + }, + "end": { + "line": 45, + "column": 8 + } + }, + "range": [ + 1172, + 1180 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 45, + "column": 8 + }, + "end": { + "line": 45, + "column": 9 + } + }, + "range": [ + 1180, + 1181 + ] + }, + { + "type": "Identifier", + "value": "accessor", + "loc": { + "start": { + "line": 45, + "column": 9 + }, + "end": { + "line": 45, + "column": 17 + } + }, + "range": [ + 1181, + 1189 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 18 + } + }, + "range": [ + 1189, + 1190 + ] + }, + { + "type": "Identifier", + "value": "instance", + "loc": { + "start": { + "line": 46, + "column": 0 + }, + "end": { + "line": 46, + "column": 8 + } + }, + "range": [ + 1191, + 1199 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 9 + } + }, + "range": [ + 1199, + 1200 + ] + }, + { + "type": "Identifier", + "value": "accessor", + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 17 + } + }, + "range": [ + 1200, + 1208 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 46, + "column": 18 + }, + "end": { + "line": 46, + "column": 19 + } + }, + "range": [ + 1209, + 1210 + ] + }, + { + "type": "String", + "value": "'setter'", + "loc": { + "start": { + "line": 46, + "column": 20 + }, + "end": { + "line": 46, + "column": 28 + } + }, + "range": [ + 1211, + 1219 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 46, + "column": 28 + }, + "end": { + "line": 46, + "column": 29 + } + }, + "range": [ + 1219, + 1220 + ] + }, + { + "type": "Identifier", + "value": "instance", + "loc": { + "start": { + "line": 47, + "column": 0 + }, + "end": { + "line": 47, + "column": 8 + } + }, + "range": [ + 1221, + 1229 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 47, + "column": 8 + }, + "end": { + "line": 47, + "column": 9 + } + }, + "range": [ + 1229, + 1230 + ] + }, + { + "type": "Identifier", + "value": "gen", + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 12 + } + }, + "range": [ + 1230, + 1233 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 47, + "column": 12 + }, + "end": { + "line": 47, + "column": 13 + } + }, + "range": [ + 1233, + 1234 + ] + }, + { + "type": "String", + "value": "'generator method'", + "loc": { + "start": { + "line": 47, + "column": 13 + }, + "end": { + "line": 47, + "column": 31 + } + }, + "range": [ + 1234, + 1252 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 47, + "column": 31 + }, + "end": { + "line": 47, + "column": 32 + } + }, + "range": [ + 1252, + 1253 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 47, + "column": 32 + }, + "end": { + "line": 47, + "column": 33 + } + }, + "range": [ + 1253, + 1254 + ] + }, + { + "type": "Identifier", + "value": "next", + "loc": { + "start": { + "line": 47, + "column": 33 + }, + "end": { + "line": 47, + "column": 37 + } + }, + "range": [ + 1254, + 1258 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 47, + "column": 37 + }, + "end": { + "line": 47, + "column": 38 + } + }, + "range": [ + 1258, + 1259 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 47, + "column": 38 + }, + "end": { + "line": 47, + "column": 39 + } + }, + "range": [ + 1259, + 1260 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 47, + "column": 39 + }, + "end": { + "line": 47, + "column": 40 + } + }, + "range": [ + 1260, + 1261 + ] + }, + { + "type": "Identifier", + "value": "instance", + "loc": { + "start": { + "line": 48, + "column": 0 + }, + "end": { + "line": 48, + "column": 8 + } + }, + "range": [ + 1262, + 1270 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 48, + "column": 8 + }, + "end": { + "line": 48, + "column": 9 + } + }, + "range": [ + 1270, + 1271 + ] + }, + { + "type": "Identifier", + "value": "async", + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 14 + } + }, + "range": [ + 1271, + 1276 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 48, + "column": 14 + }, + "end": { + "line": 48, + "column": 15 + } + }, + "range": [ + 1276, + 1277 + ] + }, + { + "type": "String", + "value": "'async method'", + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 29 + } + }, + "range": [ + 1277, + 1291 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 48, + "column": 29 + }, + "end": { + "line": 48, + "column": 30 + } + }, + "range": [ + 1291, + 1292 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 48, + "column": 30 + }, + "end": { + "line": 48, + "column": 31 + } + }, + "range": [ + 1292, + 1293 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 50, + "column": 0 + }, + "end": { + "line": 50, + "column": 6 + } + }, + "range": [ + 1295, + 1301 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 50, + "column": 6 + }, + "end": { + "line": 50, + "column": 7 + } + }, + "range": [ + 1301, + 1302 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 50, + "column": 7 + }, + "end": { + "line": 50, + "column": 19 + } + }, + "range": [ + 1302, + 1314 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 50, + "column": 19 + }, + "end": { + "line": 50, + "column": 20 + } + }, + "range": [ + 1314, + 1315 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 50, + "column": 20 + }, + "end": { + "line": 50, + "column": 21 + } + }, + "range": [ + 1315, + 1316 + ] + }, + { + "type": "String", + "value": "'method'", + "loc": { + "start": { + "line": 50, + "column": 21 + }, + "end": { + "line": 50, + "column": 29 + } + }, + "range": [ + 1316, + 1324 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 50, + "column": 29 + }, + "end": { + "line": 50, + "column": 30 + } + }, + "range": [ + 1324, + 1325 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 50, + "column": 30 + }, + "end": { + "line": 50, + "column": 31 + } + }, + "range": [ + 1325, + 1326 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 50, + "column": 32 + }, + "end": { + "line": 50, + "column": 38 + } + }, + "range": [ + 1327, + 1333 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 50, + "column": 38 + }, + "end": { + "line": 50, + "column": 39 + } + }, + "range": [ + 1333, + 1334 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 50, + "column": 39 + }, + "end": { + "line": 50, + "column": 40 + } + }, + "range": [ + 1334, + 1335 + ] + }, + { + "type": "String", + "value": "'body'", + "loc": { + "start": { + "line": 50, + "column": 41 + }, + "end": { + "line": 50, + "column": 47 + } + }, + "range": [ + 1336, + 1342 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 50, + "column": 47 + }, + "end": { + "line": 50, + "column": 48 + } + }, + "range": [ + 1342, + 1343 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 50, + "column": 48 + }, + "end": { + "line": 50, + "column": 49 + } + }, + "range": [ + 1343, + 1344 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 6 + } + }, + "range": [ + 1345, + 1351 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 51, + "column": 6 + }, + "end": { + "line": 51, + "column": 7 + } + }, + "range": [ + 1351, + 1352 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 51, + "column": 7 + }, + "end": { + "line": 51, + "column": 19 + } + }, + "range": [ + 1352, + 1364 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 51, + "column": 19 + }, + "end": { + "line": 51, + "column": 20 + } + }, + "range": [ + 1364, + 1365 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 51, + "column": 20 + }, + "end": { + "line": 51, + "column": 21 + } + }, + "range": [ + 1365, + 1366 + ] + }, + { + "type": "String", + "value": "'method'", + "loc": { + "start": { + "line": 51, + "column": 21 + }, + "end": { + "line": 51, + "column": 29 + } + }, + "range": [ + 1366, + 1374 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 51, + "column": 29 + }, + "end": { + "line": 51, + "column": 30 + } + }, + "range": [ + 1374, + 1375 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 51, + "column": 30 + }, + "end": { + "line": 51, + "column": 31 + } + }, + "range": [ + 1375, + 1376 + ] + }, + { + "type": "Identifier", + "value": "methodParam", + "loc": { + "start": { + "line": 51, + "column": 32 + }, + "end": { + "line": 51, + "column": 43 + } + }, + "range": [ + 1377, + 1388 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 51, + "column": 43 + }, + "end": { + "line": 51, + "column": 44 + } + }, + "range": [ + 1388, + 1389 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 51, + "column": 44 + }, + "end": { + "line": 51, + "column": 45 + } + }, + "range": [ + 1389, + 1390 + ] + }, + { + "type": "String", + "value": "'parameter'", + "loc": { + "start": { + "line": 51, + "column": 46 + }, + "end": { + "line": 51, + "column": 57 + } + }, + "range": [ + 1391, + 1402 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 51, + "column": 57 + }, + "end": { + "line": 51, + "column": 58 + } + }, + "range": [ + 1402, + 1403 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 51, + "column": 58 + }, + "end": { + "line": 51, + "column": 59 + } + }, + "range": [ + 1403, + 1404 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 6 + } + }, + "range": [ + 1405, + 1411 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 52, + "column": 6 + }, + "end": { + "line": 52, + "column": 7 + } + }, + "range": [ + 1411, + 1412 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 52, + "column": 7 + }, + "end": { + "line": 52, + "column": 19 + } + }, + "range": [ + 1412, + 1424 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 52, + "column": 19 + }, + "end": { + "line": 52, + "column": 20 + } + }, + "range": [ + 1424, + 1425 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 52, + "column": 20 + }, + "end": { + "line": 52, + "column": 21 + } + }, + "range": [ + 1425, + 1426 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 52, + "column": 21 + }, + "end": { + "line": 52, + "column": 22 + } + }, + "range": [ + 1426, + 1427 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 52, + "column": 22 + }, + "end": { + "line": 52, + "column": 23 + } + }, + "range": [ + 1427, + 1428 + ] + }, + { + "type": "Identifier", + "value": "getter", + "loc": { + "start": { + "line": 52, + "column": 24 + }, + "end": { + "line": 52, + "column": 30 + } + }, + "range": [ + 1429, + 1435 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 52, + "column": 30 + }, + "end": { + "line": 52, + "column": 31 + } + }, + "range": [ + 1435, + 1436 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 52, + "column": 31 + }, + "end": { + "line": 52, + "column": 32 + } + }, + "range": [ + 1436, + 1437 + ] + }, + { + "type": "String", + "value": "'body'", + "loc": { + "start": { + "line": 52, + "column": 33 + }, + "end": { + "line": 52, + "column": 39 + } + }, + "range": [ + 1438, + 1444 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 52, + "column": 39 + }, + "end": { + "line": 52, + "column": 40 + } + }, + "range": [ + 1444, + 1445 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 52, + "column": 40 + }, + "end": { + "line": 52, + "column": 41 + } + }, + "range": [ + 1445, + 1446 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 53, + "column": 0 + }, + "end": { + "line": 53, + "column": 6 + } + }, + "range": [ + 1447, + 1453 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 53, + "column": 6 + }, + "end": { + "line": 53, + "column": 7 + } + }, + "range": [ + 1453, + 1454 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 53, + "column": 7 + }, + "end": { + "line": 53, + "column": 19 + } + }, + "range": [ + 1454, + 1466 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 53, + "column": 19 + }, + "end": { + "line": 53, + "column": 20 + } + }, + "range": [ + 1466, + 1467 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 53, + "column": 20 + }, + "end": { + "line": 53, + "column": 21 + } + }, + "range": [ + 1467, + 1468 + ] + }, + { + "type": "String", + "value": "'setter'", + "loc": { + "start": { + "line": 53, + "column": 21 + }, + "end": { + "line": 53, + "column": 29 + } + }, + "range": [ + 1468, + 1476 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 53, + "column": 29 + }, + "end": { + "line": 53, + "column": 30 + } + }, + "range": [ + 1476, + 1477 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 53, + "column": 30 + }, + "end": { + "line": 53, + "column": 31 + } + }, + "range": [ + 1477, + 1478 + ] + }, + { + "type": "Identifier", + "value": "setter", + "loc": { + "start": { + "line": 53, + "column": 32 + }, + "end": { + "line": 53, + "column": 38 + } + }, + "range": [ + 1479, + 1485 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 53, + "column": 38 + }, + "end": { + "line": 53, + "column": 39 + } + }, + "range": [ + 1485, + 1486 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 53, + "column": 39 + }, + "end": { + "line": 53, + "column": 40 + } + }, + "range": [ + 1486, + 1487 + ] + }, + { + "type": "String", + "value": "'body'", + "loc": { + "start": { + "line": 53, + "column": 41 + }, + "end": { + "line": 53, + "column": 47 + } + }, + "range": [ + 1488, + 1494 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 53, + "column": 47 + }, + "end": { + "line": 53, + "column": 48 + } + }, + "range": [ + 1494, + 1495 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 53, + "column": 48 + }, + "end": { + "line": 53, + "column": 49 + } + }, + "range": [ + 1495, + 1496 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 54, + "column": 0 + }, + "end": { + "line": 54, + "column": 6 + } + }, + "range": [ + 1497, + 1503 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 54, + "column": 6 + }, + "end": { + "line": 54, + "column": 7 + } + }, + "range": [ + 1503, + 1504 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 54, + "column": 7 + }, + "end": { + "line": 54, + "column": 19 + } + }, + "range": [ + 1504, + 1516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 54, + "column": 19 + }, + "end": { + "line": 54, + "column": 20 + } + }, + "range": [ + 1516, + 1517 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 54, + "column": 20 + }, + "end": { + "line": 54, + "column": 21 + } + }, + "range": [ + 1517, + 1518 + ] + }, + { + "type": "String", + "value": "'setter'", + "loc": { + "start": { + "line": 54, + "column": 21 + }, + "end": { + "line": 54, + "column": 29 + } + }, + "range": [ + 1518, + 1526 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 54, + "column": 29 + }, + "end": { + "line": 54, + "column": 30 + } + }, + "range": [ + 1526, + 1527 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 54, + "column": 30 + }, + "end": { + "line": 54, + "column": 31 + } + }, + "range": [ + 1527, + 1528 + ] + }, + { + "type": "Identifier", + "value": "setterParam", + "loc": { + "start": { + "line": 54, + "column": 32 + }, + "end": { + "line": 54, + "column": 43 + } + }, + "range": [ + 1529, + 1540 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 54, + "column": 43 + }, + "end": { + "line": 54, + "column": 44 + } + }, + "range": [ + 1540, + 1541 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 54, + "column": 44 + }, + "end": { + "line": 54, + "column": 45 + } + }, + "range": [ + 1541, + 1542 + ] + }, + { + "type": "String", + "value": "'parameter'", + "loc": { + "start": { + "line": 54, + "column": 46 + }, + "end": { + "line": 54, + "column": 57 + } + }, + "range": [ + 1543, + 1554 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 54, + "column": 57 + }, + "end": { + "line": 54, + "column": 58 + } + }, + "range": [ + 1554, + 1555 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 54, + "column": 58 + }, + "end": { + "line": 54, + "column": 59 + } + }, + "range": [ + 1555, + 1556 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 55, + "column": 0 + }, + "end": { + "line": 55, + "column": 6 + } + }, + "range": [ + 1557, + 1563 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 55, + "column": 6 + }, + "end": { + "line": 55, + "column": 7 + } + }, + "range": [ + 1563, + 1564 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 55, + "column": 7 + }, + "end": { + "line": 55, + "column": 19 + } + }, + "range": [ + 1564, + 1576 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 55, + "column": 19 + }, + "end": { + "line": 55, + "column": 20 + } + }, + "range": [ + 1576, + 1577 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 55, + "column": 20 + }, + "end": { + "line": 55, + "column": 21 + } + }, + "range": [ + 1577, + 1578 + ] + }, + { + "type": "String", + "value": "'generator method'", + "loc": { + "start": { + "line": 55, + "column": 21 + }, + "end": { + "line": 55, + "column": 39 + } + }, + "range": [ + 1578, + 1596 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 55, + "column": 39 + }, + "end": { + "line": 55, + "column": 40 + } + }, + "range": [ + 1596, + 1597 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 55, + "column": 40 + }, + "end": { + "line": 55, + "column": 41 + } + }, + "range": [ + 1597, + 1598 + ] + }, + { + "type": "Identifier", + "value": "genMethod", + "loc": { + "start": { + "line": 55, + "column": 42 + }, + "end": { + "line": 55, + "column": 51 + } + }, + "range": [ + 1599, + 1608 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 55, + "column": 51 + }, + "end": { + "line": 55, + "column": 52 + } + }, + "range": [ + 1608, + 1609 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 55, + "column": 52 + }, + "end": { + "line": 55, + "column": 53 + } + }, + "range": [ + 1609, + 1610 + ] + }, + { + "type": "String", + "value": "'body'", + "loc": { + "start": { + "line": 55, + "column": 54 + }, + "end": { + "line": 55, + "column": 60 + } + }, + "range": [ + 1611, + 1617 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 55, + "column": 60 + }, + "end": { + "line": 55, + "column": 61 + } + }, + "range": [ + 1617, + 1618 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 55, + "column": 61 + }, + "end": { + "line": 55, + "column": 62 + } + }, + "range": [ + 1618, + 1619 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 56, + "column": 0 + }, + "end": { + "line": 56, + "column": 6 + } + }, + "range": [ + 1620, + 1626 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 56, + "column": 6 + }, + "end": { + "line": 56, + "column": 7 + } + }, + "range": [ + 1626, + 1627 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 56, + "column": 7 + }, + "end": { + "line": 56, + "column": 19 + } + }, + "range": [ + 1627, + 1639 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 56, + "column": 19 + }, + "end": { + "line": 56, + "column": 20 + } + }, + "range": [ + 1639, + 1640 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 56, + "column": 20 + }, + "end": { + "line": 56, + "column": 21 + } + }, + "range": [ + 1640, + 1641 + ] + }, + { + "type": "String", + "value": "'generator method'", + "loc": { + "start": { + "line": 56, + "column": 21 + }, + "end": { + "line": 56, + "column": 39 + } + }, + "range": [ + 1641, + 1659 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 56, + "column": 39 + }, + "end": { + "line": 56, + "column": 40 + } + }, + "range": [ + 1659, + 1660 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 56, + "column": 40 + }, + "end": { + "line": 56, + "column": 41 + } + }, + "range": [ + 1660, + 1661 + ] + }, + { + "type": "Identifier", + "value": "genMethodParam", + "loc": { + "start": { + "line": 56, + "column": 42 + }, + "end": { + "line": 56, + "column": 56 + } + }, + "range": [ + 1662, + 1676 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 56, + "column": 56 + }, + "end": { + "line": 56, + "column": 57 + } + }, + "range": [ + 1676, + 1677 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 56, + "column": 57 + }, + "end": { + "line": 56, + "column": 58 + } + }, + "range": [ + 1677, + 1678 + ] + }, + { + "type": "String", + "value": "'parameter'", + "loc": { + "start": { + "line": 56, + "column": 59 + }, + "end": { + "line": 56, + "column": 70 + } + }, + "range": [ + 1679, + 1690 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 56, + "column": 70 + }, + "end": { + "line": 56, + "column": 71 + } + }, + "range": [ + 1690, + 1691 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 56, + "column": 71 + }, + "end": { + "line": 56, + "column": 72 + } + }, + "range": [ + 1691, + 1692 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 57, + "column": 0 + }, + "end": { + "line": 57, + "column": 6 + } + }, + "range": [ + 1693, + 1699 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 57, + "column": 6 + }, + "end": { + "line": 57, + "column": 7 + } + }, + "range": [ + 1699, + 1700 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 57, + "column": 7 + }, + "end": { + "line": 57, + "column": 19 + } + }, + "range": [ + 1700, + 1712 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 57, + "column": 19 + }, + "end": { + "line": 57, + "column": 20 + } + }, + "range": [ + 1712, + 1713 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 57, + "column": 20 + }, + "end": { + "line": 57, + "column": 21 + } + }, + "range": [ + 1713, + 1714 + ] + }, + { + "type": "String", + "value": "'async method'", + "loc": { + "start": { + "line": 57, + "column": 21 + }, + "end": { + "line": 57, + "column": 35 + } + }, + "range": [ + 1714, + 1728 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 57, + "column": 35 + }, + "end": { + "line": 57, + "column": 36 + } + }, + "range": [ + 1728, + 1729 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 57, + "column": 36 + }, + "end": { + "line": 57, + "column": 37 + } + }, + "range": [ + 1729, + 1730 + ] + }, + { + "type": "Identifier", + "value": "asyncMethod", + "loc": { + "start": { + "line": 57, + "column": 38 + }, + "end": { + "line": 57, + "column": 49 + } + }, + "range": [ + 1731, + 1742 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 57, + "column": 49 + }, + "end": { + "line": 57, + "column": 50 + } + }, + "range": [ + 1742, + 1743 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 57, + "column": 50 + }, + "end": { + "line": 57, + "column": 51 + } + }, + "range": [ + 1743, + 1744 + ] + }, + { + "type": "String", + "value": "'body'", + "loc": { + "start": { + "line": 57, + "column": 52 + }, + "end": { + "line": 57, + "column": 58 + } + }, + "range": [ + 1745, + 1751 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 57, + "column": 58 + }, + "end": { + "line": 57, + "column": 59 + } + }, + "range": [ + 1751, + 1752 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 57, + "column": 59 + }, + "end": { + "line": 57, + "column": 60 + } + }, + "range": [ + 1752, + 1753 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 58, + "column": 0 + }, + "end": { + "line": 58, + "column": 6 + } + }, + "range": [ + 1754, + 1760 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 58, + "column": 6 + }, + "end": { + "line": 58, + "column": 7 + } + }, + "range": [ + 1760, + 1761 + ] + }, + { + "type": "Identifier", + "value": "compareArray", + "loc": { + "start": { + "line": 58, + "column": 7 + }, + "end": { + "line": 58, + "column": 19 + } + }, + "range": [ + 1761, + 1773 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 58, + "column": 19 + }, + "end": { + "line": 58, + "column": 20 + } + }, + "range": [ + 1773, + 1774 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 58, + "column": 20 + }, + "end": { + "line": 58, + "column": 21 + } + }, + "range": [ + 1774, + 1775 + ] + }, + { + "type": "String", + "value": "'async method'", + "loc": { + "start": { + "line": 58, + "column": 21 + }, + "end": { + "line": 58, + "column": 35 + } + }, + "range": [ + 1775, + 1789 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 58, + "column": 35 + }, + "end": { + "line": 58, + "column": 36 + } + }, + "range": [ + 1789, + 1790 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 58, + "column": 36 + }, + "end": { + "line": 58, + "column": 37 + } + }, + "range": [ + 1790, + 1791 + ] + }, + { + "type": "Identifier", + "value": "asyncMethodParam", + "loc": { + "start": { + "line": 58, + "column": 38 + }, + "end": { + "line": 58, + "column": 54 + } + }, + "range": [ + 1792, + 1808 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 58, + "column": 54 + }, + "end": { + "line": 58, + "column": 55 + } + }, + "range": [ + 1808, + 1809 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 58, + "column": 55 + }, + "end": { + "line": 58, + "column": 56 + } + }, + "range": [ + 1809, + 1810 + ] + }, + { + "type": "String", + "value": "'parameter'", + "loc": { + "start": { + "line": 58, + "column": 57 + }, + "end": { + "line": 58, + "column": 68 + } + }, + "range": [ + 1811, + 1822 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 58, + "column": 68 + }, + "end": { + "line": 58, + "column": 69 + } + }, + "range": [ + 1822, + 1823 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 58, + "column": 69 + }, + "end": { + "line": 58, + "column": 70 + } + }, + "range": [ + 1823, + 1824 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-methods.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-methods.src.js new file mode 100644 index 00000000..66862156 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-arguments-methods.src.js @@ -0,0 +1,58 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The identifier `arguments` is not restricted within method forms +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if ContainsArguments of ClassStaticBlockStatementList + is true. +includes: [compareArray.js] +features: [class-static-block] +---*/ + +var instance; +var method, methodParam; +var getter; +var setter, setterParam; +var genMethod, genMethodParam; +var asyncMethod, asyncMethodParam; + +class C { + static { + instance = new class { + method({test262 = methodParam = arguments}) { + method = arguments; + } + get accessor() { + getter = arguments; + } + set accessor({test262 = setterParam = arguments}) { + setter = arguments; + } + *gen({test262 = genMethodParam = arguments}) { + genMethod = arguments; + } + async async({test262 = asyncMethodParam = arguments}) { + asyncMethod = arguments; + } + }(); + } +} + +instance.method('method'); +instance.accessor; +instance.accessor = 'setter'; +instance.gen('generator method').next(); +instance.async('async method'); + +assert(compareArray(['method'], method), 'body'); +assert(compareArray(['method'], methodParam), 'parameter'); +assert(compareArray([], getter), 'body'); +assert(compareArray(['setter'], setter), 'body'); +assert(compareArray(['setter'], setterParam), 'parameter'); +assert(compareArray(['generator method'], genMethod), 'body'); +assert(compareArray(['generator method'], genMethodParam), 'parameter'); +assert(compareArray(['async method'], asyncMethod), 'body'); +assert(compareArray(['async method'], asyncMethodParam), 'parameter'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-invalid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-invalid.result.js new file mode 100644 index 00000000..7895ae92 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-invalid.result.js @@ -0,0 +1,6 @@ +export default { + "index": 715, + "lineNumber": 24, + "column": 11, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-invalid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-invalid.src.js new file mode 100644 index 00000000..3f43b913 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-invalid.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: BindingIdentifier may not be `await` within class static blocks +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + class await {} + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.module-result.js new file mode 100644 index 00000000..f3d6219c --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 530, + "lineNumber": 16, + "column": 20, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.result.js new file mode 100644 index 00000000..2d5030c0 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.result.js @@ -0,0 +1,550 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 548 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 548 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 548 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 502, + 546 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 515, + 542 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 516, + 540 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 522, + 540 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 524, + 538 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 530, + 535 + ], + "name": "await" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 536, + 538 + ], + "body": [] + } + } + ] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 490, + 495 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 502, + 508 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 509, + 510 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 515, + 516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 519, + 521 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 524, + 529 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 530, + 535 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "range": [ + 536, + 537 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 537, + 538 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 539, + 540 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 30 + } + }, + "range": [ + 540, + 541 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 30 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 541, + 542 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 545, + 546 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 547, + 548 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.src.js new file mode 100644 index 00000000..fe10bb9c --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-await-binding-valid.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within arrow function bodies +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => { class await {} }); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-new-target.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-new-target.result.js new file mode 100644 index 00000000..ff4e2037 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-new-target.result.js @@ -0,0 +1,890 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 23, + "column": 35 + } + }, + "range": [ + 527, + 633 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 17 + } + }, + "range": [ + 527, + 544 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "range": [ + 531, + 543 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 531, + 536 + ], + "name": "value" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "range": [ + 539, + 543 + ], + "value": null, + "raw": "null" + } + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 546, + 596 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 552, + 553 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 554, + 596 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + }, + "range": [ + 558, + 594 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 23 + } + }, + "range": [ + 571, + 590 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 22 + } + }, + "range": [ + 571, + 589 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "range": [ + 571, + 576 + ], + "name": "value" + }, + "right": { + "type": "MetaProperty", + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 22 + } + }, + "range": [ + 579, + 589 + ], + "meta": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "range": [ + 579, + 582 + ], + "name": "new" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 22 + } + }, + "range": [ + 583, + 589 + ], + "name": "target" + } + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 35 + } + }, + "range": [ + 598, + 633 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 34 + } + }, + "range": [ + 598, + 632 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 598, + 614 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 598, + 604 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 605, + 614 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "range": [ + 615, + 620 + ], + "name": "value" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 24 + }, + "end": { + "line": 23, + "column": 33 + } + }, + "range": [ + 622, + 631 + ], + "name": "undefined" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 527, + 530 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 531, + 536 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 537, + 538 + ] + }, + { + "type": "Null", + "value": "null", + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "range": [ + 539, + 543 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 17 + } + }, + "range": [ + 543, + 544 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 546, + 551 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 552, + 553 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 554, + 555 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 558, + 564 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 565, + 566 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "range": [ + 571, + 576 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 11 + } + }, + "range": [ + 577, + 578 + ] + }, + { + "type": "Keyword", + "value": "new", + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "range": [ + 579, + 582 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 16 + } + }, + "range": [ + 582, + 583 + ] + }, + { + "type": "Identifier", + "value": "target", + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 22 + } + }, + "range": [ + 583, + 589 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + }, + "range": [ + 589, + 590 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + }, + "range": [ + 593, + 594 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 595, + 596 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 598, + 604 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + }, + "range": [ + 604, + 605 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 605, + 614 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "range": [ + 614, + 615 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "range": [ + 615, + 620 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 23 + } + }, + "range": [ + 620, + 621 + ] + }, + { + "type": "Identifier", + "value": "undefined", + "loc": { + "start": { + "line": 23, + "column": 24 + }, + "end": { + "line": 23, + "column": 33 + } + }, + "range": [ + 622, + 631 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 33 + }, + "end": { + "line": 23, + "column": 34 + } + }, + "range": [ + 631, + 632 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 34 + }, + "end": { + "line": 23, + "column": 35 + } + }, + "range": [ + 632, + 633 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-new-target.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-new-target.src.js new file mode 100644 index 00000000..10d34771 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-new-target.src.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-operations-on-objects +description: The "new.target" value within a static initialization block is undefined +info: | + 2.1.1 EvaluateStaticBlock ( receiver , blockRecord ) + + 1. Assert: Type(receiver) is Object. + 2. Assert: blockRecord is a ClassStaticBlockDefinition Record. + 3. Perform ? Call(blockRecord.[[Body]], receiver). +features: [class-static-block] +---*/ + +var value = null; + +class C { + static { + value = new.target; + } +} + +assert.sameValue(value, undefined); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-this.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-this.result.js new file mode 100644 index 00000000..8c6d6883 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-this.result.js @@ -0,0 +1,764 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "range": [ + 521, + 606 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 521, + 531 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 525, + 530 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 525, + 530 + ], + "name": "value" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 533, + 577 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 539, + 540 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 541, + 577 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + }, + "range": [ + 545, + 575 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 17 + } + }, + "range": [ + 558, + 571 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 16 + } + }, + "range": [ + 558, + 570 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "range": [ + 558, + 563 + ], + "name": "value" + }, + "right": { + "type": "ThisExpression", + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 16 + } + }, + "range": [ + 566, + 570 + ] + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "range": [ + 579, + 606 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 26 + } + }, + "range": [ + 579, + 605 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 579, + 595 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 579, + 585 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 586, + 595 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "range": [ + 596, + 601 + ], + "name": "value" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 24 + }, + "end": { + "line": 23, + "column": 25 + } + }, + "range": [ + 603, + 604 + ], + "name": "C" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 521, + 524 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 525, + 530 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 530, + 531 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 533, + 538 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 539, + 540 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 541, + 542 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 545, + 551 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 552, + 553 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "range": [ + 558, + 563 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 11 + } + }, + "range": [ + 564, + 565 + ] + }, + { + "type": "Keyword", + "value": "this", + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 16 + } + }, + "range": [ + 566, + 570 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 17 + } + }, + "range": [ + 570, + 571 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + }, + "range": [ + 574, + 575 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 576, + 577 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 579, + 585 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + }, + "range": [ + 585, + 586 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 586, + 595 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "range": [ + 595, + 596 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "range": [ + 596, + 601 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 23 + } + }, + "range": [ + 601, + 602 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 23, + "column": 24 + }, + "end": { + "line": 23, + "column": 25 + } + }, + "range": [ + 603, + 604 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 25 + }, + "end": { + "line": 23, + "column": 26 + } + }, + "range": [ + 604, + 605 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "range": [ + 605, + 606 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-this.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-this.src.js new file mode 100644 index 00000000..4d6f6ca2 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-expr-this.src.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-operations-on-objects +description: The "this" value within a static initialization block is the class +info: | + 2.1.1 EvaluateStaticBlock ( receiver , blockRecord ) + + 1. Assert: Type(receiver) is Object. + 2. Assert: blockRecord is a ClassStaticBlockDefinition Record. + 3. Perform ? Call(blockRecord.[[Body]], receiver). +features: [class-static-block] +---*/ + +var value; + +class C { + static { + value = this; + } +} + +assert.sameValue(value, C); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-arguments.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-arguments.result.js new file mode 100644 index 00000000..e719ba08 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-arguments.result.js @@ -0,0 +1,6 @@ +export default { + "index": 554, + "lineNumber": 21, + "column": 15, + "message": "Cannot use arguments in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-arguments.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-arguments.src.js new file mode 100644 index 00000000..1f791bfc --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-arguments.src.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Block cannot use `arguments` as an identifier +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if ContainsArguments of ClassStaticBlockStatementList + is true. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + (class { [argument\u0073]() {} }); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-await.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-await.result.js new file mode 100644 index 00000000..1632d4de --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-await.result.js @@ -0,0 +1,6 @@ +export default { + "index": 705, + "lineNumber": 30, + "column": 7, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-await.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-await.src.js new file mode 100644 index 00000000..06e51155 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-await.src.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions +description: The "Await" parsing context does not apply to the block's statement list +info: | + Syntax + + [...] + + ClassStaticBlockStatementList : + StatementList[~Yield, +Await, ~Return]opt + + ## 15.7.1 Static Semantics: Early Errors + + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +async function f() { + class C { + static { + await 0; + } + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-label-dup.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-label-dup.result.js new file mode 100644 index 00000000..51fb0449 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-label-dup.result.js @@ -0,0 +1,6 @@ +export default { + "index": 563, + "lineNumber": 21, + "column": 8, + "message": "Label 'x' is already declared" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-label-dup.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-label-dup.src.js new file mode 100644 index 00000000..352c37ed --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-label-dup.src.js @@ -0,0 +1,24 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Block cannot declare duplicate labels +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if ContainsDuplicateLabels of + ClassStaticBlockStatementList with argument « » is true. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + x: x: 0; + } +} + diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-dup.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-dup.result.js new file mode 100644 index 00000000..0c0c376f --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-dup.result.js @@ -0,0 +1,6 @@ +export default { + "index": 602, + "lineNumber": 22, + "column": 9, + "message": "Identifier 'x' has already been declared" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-dup.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-dup.src.js new file mode 100644 index 00000000..59312e49 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-dup.src.js @@ -0,0 +1,24 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Block cannot declare duplicate lexically-scoped bindings +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if the LexicallyDeclaredNames of + ClassStaticBlockStatementList contains any duplicate entries. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + let x; + let x; + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-var.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-var.result.js new file mode 100644 index 00000000..75a029d3 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-var.result.js @@ -0,0 +1,6 @@ +export default { + "index": 698, + "lineNumber": 23, + "column": 9, + "message": "Identifier 'x' has already been declared" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-var.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-var.src.js new file mode 100644 index 00000000..2e78d276 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-lex-var.src.js @@ -0,0 +1,25 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Block cannot declare a lexically-scoped binding and function-scoped binding with the same name. +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if any element of the LexicallyDeclaredNames of + ClassStaticBlockStatementList also occurs in the VarDeclaredNames of + ClassStaticBlockStatementList. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + let x; + var x; + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-return.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-return.result.js new file mode 100644 index 00000000..a2b8a8ca --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-return.result.js @@ -0,0 +1,6 @@ +export default { + "index": 515, + "lineNumber": 24, + "column": 7, + "message": "'return' outside of function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-return.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-return.src.js new file mode 100644 index 00000000..dda77131 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-return.src.js @@ -0,0 +1,27 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions +description: The "Return" parsing context does not apply to the block's statement list +info: | + Syntax + + [...] + + ClassStaticBlockStatementList : + StatementList[~Yield, +Await, ~Return]opt +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +function f() { + class C { + static { + return; + } + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-super-call.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-super-call.result.js new file mode 100644 index 00000000..1ed3ba1e --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-super-call.result.js @@ -0,0 +1,6 @@ +export default { + "index": 507, + "lineNumber": 20, + "column": 5, + "message": "super() call outside constructor of a subclass" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-super-call.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-super-call.src.js new file mode 100644 index 00000000..66e6bf13 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-super-call.src.js @@ -0,0 +1,22 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Block cannot contain SuperCall +info: | + ClassStaticBlock : static { ClassStaticBlockBody } + + - It is a Syntax Error if HasDirectSuper of ClassStaticBlock is true. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + super(); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-break-target.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-break-target.result.js new file mode 100644 index 00000000..4030eb10 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-break-target.result.js @@ -0,0 +1,6 @@ +export default { + "index": 603, + "lineNumber": 22, + "column": 7, + "message": "Unsyntactic break" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-break-target.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-break-target.src.js new file mode 100644 index 00000000..fa11b904 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-break-target.src.js @@ -0,0 +1,25 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Block cannot reference an undefined `break` target +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if ContainsUndefinedBreakTarget of + ClassStaticBlockStatementList with argument « » is true. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + x: while (false) { + break y; + } + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-continue-target.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-continue-target.result.js new file mode 100644 index 00000000..e123cb86 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-continue-target.result.js @@ -0,0 +1,6 @@ +export default { + "index": 618, + "lineNumber": 22, + "column": 7, + "message": "Unsyntactic continue" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-continue-target.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-continue-target.src.js new file mode 100644 index 00000000..389245a0 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-undefined-continue-target.src.js @@ -0,0 +1,25 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Block cannot reference an undefined `continue` target +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if ContainsUndefinedContinueTarget of + ClassStaticBlockStatementList with arguments « » and « » is true. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + x: while (false) { + continue y; + } + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-yield.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-yield.result.js new file mode 100644 index 00000000..bc483e7c --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-yield.result.js @@ -0,0 +1,6 @@ +export default { + "index": 516, + "lineNumber": 24, + "column": 7, + "message": "The keyword 'yield' is reserved" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-yield.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-yield.src.js new file mode 100644 index 00000000..60ab3925 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-invalid-yield.src.js @@ -0,0 +1,27 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions +description: The "Yield" parsing context does not apply to the block's statement list +info: | + Syntax + + [...] + + ClassStaticBlockStatementList : + StatementList[~Yield, +Await, ~Return]opt +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +function * g() { + class C { + static { + yield; + } + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-close.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-close.result.js new file mode 100644 index 00000000..95283f47 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-close.result.js @@ -0,0 +1,1167 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 27, + "column": 39 + } + }, + "range": [ + 631, + 808 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 631, + 659 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 635, + 658 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 635, + 642 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 645, + 658 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 660, + 670 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 664, + 669 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 664, + 669 + ], + "name": "probe" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 672, + 767 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 678, + 679 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 680, + 767 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "range": [ + 684, + 729 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 697, + 725 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 701, + 724 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 701, + 708 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 711, + 724 + ], + "value": "first block", + "raw": "'first block'" + } + } + ], + "kind": "let" + } + ] + }, + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 732, + 765 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 20 + } + }, + "range": [ + 745, + 761 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 19 + } + }, + "range": [ + 745, + 760 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 9 + } + }, + "range": [ + 745, + 750 + ], + "name": "probe" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 19 + } + }, + "range": [ + 753, + 760 + ], + "name": "test262" + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 39 + } + }, + "range": [ + 769, + 808 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 38 + } + }, + "range": [ + 769, + 807 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 769, + 785 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 769, + 775 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 776, + 785 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "range": [ + 786, + 791 + ], + "name": "probe" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 37 + } + }, + "range": [ + 793, + 806 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 631, + 634 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 635, + 642 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 643, + 644 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 645, + 658 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 27 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 658, + 659 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 3 + } + }, + "range": [ + 660, + 663 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 664, + 669 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 669, + 670 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 5 + } + }, + "range": [ + 672, + 677 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 678, + 679 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + }, + "range": [ + 680, + 681 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 8 + } + }, + "range": [ + 684, + 690 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "range": [ + 691, + 692 + ] + }, + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 7 + } + }, + "range": [ + 697, + 700 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 701, + 708 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 17 + } + }, + "range": [ + 709, + 710 + ] + }, + { + "type": "String", + "value": "'first block'", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 711, + 724 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 20, + "column": 31 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 724, + 725 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "range": [ + 728, + 729 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 8 + } + }, + "range": [ + 732, + 738 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 22, + "column": 10 + } + }, + "range": [ + 739, + 740 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 9 + } + }, + "range": [ + 745, + 750 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 11 + } + }, + "range": [ + 751, + 752 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 19 + } + }, + "range": [ + 753, + 760 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 19 + }, + "end": { + "line": 23, + "column": 20 + } + }, + "range": [ + 760, + 761 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 764, + 765 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 766, + 767 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 769, + 775 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 775, + 776 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 776, + 785 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "range": [ + 785, + 786 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "range": [ + 786, + 791 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 23 + } + }, + "range": [ + 791, + 792 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 37 + } + }, + "range": [ + 793, + 806 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 37 + }, + "end": { + "line": 27, + "column": 38 + } + }, + "range": [ + 806, + 807 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 27, + "column": 38 + }, + "end": { + "line": 27, + "column": 39 + } + }, + "range": [ + 807, + 808 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-close.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-close.src.js new file mode 100644 index 00000000..f7a21511 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-close.src.js @@ -0,0 +1,27 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classstaticblockdefinitionevaluation +description: Destruction of environment record for variable-scoped bindings +info: | + ClassStaticBlock : static { ClassStaticBlockBody } + + 1. Let lex be the running execution context's LexicalEnvironment. + 2. Let privateScope be the running execution context's PrivateEnvironment. + 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope). +features: [class-static-block] +---*/ + +var test262 = 'outer scope'; +var probe; + +class C { + static { + let test262 = 'first block'; + } + static { + probe = test262; + } +} + +assert.sameValue(probe, 'outer scope'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-derived.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-derived.result.js new file mode 100644 index 00000000..6ea1e8c8 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-derived.result.js @@ -0,0 +1,765 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "range": [ + 631, + 713 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 631, + 641 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 635, + 640 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 635, + 640 + ], + "name": "probe" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 643, + 684 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 649, + 650 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 651, + 684 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + }, + "range": [ + 655, + 682 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 14 + } + }, + "range": [ + 668, + 678 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 13 + } + }, + "range": [ + 668, + 677 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "range": [ + 668, + 673 + ], + "name": "probe" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 13 + } + }, + "range": [ + 676, + 677 + ], + "name": "C" + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "range": [ + 686, + 713 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 26 + } + }, + "range": [ + 686, + 712 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 686, + 702 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 686, + 692 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 693, + 702 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "range": [ + 703, + 708 + ], + "name": "probe" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 24 + }, + "end": { + "line": 23, + "column": 25 + } + }, + "range": [ + 710, + 711 + ], + "name": "C" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 631, + 634 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 635, + 640 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 640, + 641 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 643, + 648 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 649, + 650 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 651, + 652 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 655, + 661 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "range": [ + 662, + 663 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "range": [ + 668, + 673 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 11 + } + }, + "range": [ + 674, + 675 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 13 + } + }, + "range": [ + 676, + 677 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 19, + "column": 13 + }, + "end": { + "line": 19, + "column": 14 + } + }, + "range": [ + 677, + 678 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 3 + } + }, + "range": [ + 681, + 682 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "range": [ + 683, + 684 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + }, + "range": [ + 686, + 692 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + }, + "range": [ + 692, + 693 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "range": [ + 693, + 702 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "range": [ + 702, + 703 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "range": [ + 703, + 708 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 23 + } + }, + "range": [ + 708, + 709 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 23, + "column": 24 + }, + "end": { + "line": 23, + "column": 25 + } + }, + "range": [ + 710, + 711 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 23, + "column": 25 + }, + "end": { + "line": 23, + "column": 26 + } + }, + "range": [ + 711, + 712 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "range": [ + 712, + 713 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-derived.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-derived.src.js new file mode 100644 index 00000000..664ad099 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-derived.src.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classstaticblockdefinitionevaluation +description: Derivation of environment record for lexically-scoped bindings +info: | + ClassStaticBlock : static { ClassStaticBlockBody } + + 1. Let lex be the running execution context's LexicalEnvironment. + 2. Let privateScope be the running execution context's PrivateEnvironment. + 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope). +features: [class-static-block] +---*/ + +let probe; + +class C { + static { + probe = C; + } +} + +assert.sameValue(probe, C); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-open.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-open.result.js new file mode 100644 index 00000000..4a1154e0 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-open.result.js @@ -0,0 +1,2128 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "range": [ + 633, + 961 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 633, + 661 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 637, + 660 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 637, + 644 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 647, + 660 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 662, + 681 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 666, + 672 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 666, + 672 + ], + "name": "probe1" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 674, + 680 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 674, + 680 + ], + "name": "probe2" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 27, + "column": 1 + } + }, + "range": [ + 683, + 835 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 689, + 690 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 27, + "column": 1 + } + }, + "range": [ + 691, + 835 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 695, + 762 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 708, + 736 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 712, + 735 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 712, + 719 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 722, + 735 + ], + "value": "first block", + "raw": "'first block'" + } + } + ], + "kind": "let" + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 21 + } + }, + "range": [ + 741, + 758 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 20 + } + }, + "range": [ + 741, + 757 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 10 + } + }, + "range": [ + 741, + 747 + ], + "name": "probe1" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 20 + } + }, + "range": [ + 750, + 757 + ], + "name": "test262" + } + } + } + ] + }, + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 26, + "column": 3 + } + }, + "range": [ + 765, + 833 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 33 + } + }, + "range": [ + 778, + 807 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 32 + } + }, + "range": [ + 782, + 806 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 15 + } + }, + "range": [ + 782, + 789 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 24, + "column": 18 + }, + "end": { + "line": 24, + "column": 32 + } + }, + "range": [ + 792, + 806 + ], + "value": "second block", + "raw": "'second block'" + } + } + ], + "kind": "let" + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 812, + 829 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 20 + } + }, + "range": [ + 812, + 828 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 10 + } + }, + "range": [ + 812, + 818 + ], + "name": "probe2" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 20 + } + }, + "range": [ + 821, + 828 + ], + "name": "test262" + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 41 + } + }, + "range": [ + 837, + 878 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 40 + } + }, + "range": [ + 837, + 877 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 16 + } + }, + "range": [ + 837, + 853 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 6 + } + }, + "range": [ + 837, + 843 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 16 + } + }, + "range": [ + 844, + 853 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 17 + }, + "end": { + "line": 29, + "column": 24 + } + }, + "range": [ + 854, + 861 + ], + "name": "test262" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 29, + "column": 26 + }, + "end": { + "line": 29, + "column": 39 + } + }, + "range": [ + 863, + 876 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 40 + } + }, + "range": [ + 879, + 919 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 39 + } + }, + "range": [ + 879, + 918 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "range": [ + 879, + 895 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 6 + } + }, + "range": [ + 879, + 885 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "range": [ + 886, + 895 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 30, + "column": 17 + }, + "end": { + "line": 30, + "column": 23 + } + }, + "range": [ + 896, + 902 + ], + "name": "probe1" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 30, + "column": 25 + }, + "end": { + "line": 30, + "column": 38 + } + }, + "range": [ + 904, + 917 + ], + "value": "first block", + "raw": "'first block'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "range": [ + 920, + 961 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 40 + } + }, + "range": [ + 920, + 960 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "range": [ + 920, + 936 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 6 + } + }, + "range": [ + 920, + 926 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "range": [ + 927, + 936 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 23 + } + }, + "range": [ + 937, + 943 + ], + "name": "probe2" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 31, + "column": 25 + }, + "end": { + "line": 31, + "column": 39 + } + }, + "range": [ + 945, + 959 + ], + "value": "second block", + "raw": "'second block'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 633, + 636 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 637, + 644 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 645, + 646 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 647, + 660 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 27 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 660, + 661 + ] + }, + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 3 + } + }, + "range": [ + 662, + 665 + ] + }, + { + "type": "Identifier", + "value": "probe1", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 666, + 672 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 11 + } + }, + "range": [ + 672, + 673 + ] + }, + { + "type": "Identifier", + "value": "probe2", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 674, + 680 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 680, + 681 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 5 + } + }, + "range": [ + 683, + 688 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 689, + 690 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + }, + "range": [ + 691, + 692 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 8 + } + }, + "range": [ + 695, + 701 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "range": [ + 702, + 703 + ] + }, + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 7 + } + }, + "range": [ + 708, + 711 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 712, + 719 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 17 + } + }, + "range": [ + 720, + 721 + ] + }, + { + "type": "String", + "value": "'first block'", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 722, + 735 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 20, + "column": 31 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 735, + 736 + ] + }, + { + "type": "Identifier", + "value": "probe1", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 10 + } + }, + "range": [ + 741, + 747 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 21, + "column": 11 + }, + "end": { + "line": 21, + "column": 12 + } + }, + "range": [ + 748, + 749 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 20 + } + }, + "range": [ + 750, + 757 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 21 + } + }, + "range": [ + 757, + 758 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 761, + 762 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 8 + } + }, + "range": [ + 765, + 771 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 10 + } + }, + "range": [ + 772, + 773 + ] + }, + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 7 + } + }, + "range": [ + 778, + 781 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 15 + } + }, + "range": [ + 782, + 789 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 17 + } + }, + "range": [ + 790, + 791 + ] + }, + { + "type": "String", + "value": "'second block'", + "loc": { + "start": { + "line": 24, + "column": 18 + }, + "end": { + "line": 24, + "column": 32 + } + }, + "range": [ + 792, + 806 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 24, + "column": 32 + }, + "end": { + "line": 24, + "column": 33 + } + }, + "range": [ + 806, + 807 + ] + }, + { + "type": "Identifier", + "value": "probe2", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 10 + } + }, + "range": [ + 812, + 818 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 12 + } + }, + "range": [ + 819, + 820 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 20 + } + }, + "range": [ + 821, + 828 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 25, + "column": 20 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 828, + 829 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 3 + } + }, + "range": [ + 832, + 833 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 1 + } + }, + "range": [ + 834, + 835 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 6 + } + }, + "range": [ + 837, + 843 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 29, + "column": 6 + }, + "end": { + "line": 29, + "column": 7 + } + }, + "range": [ + 843, + 844 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 16 + } + }, + "range": [ + 844, + 853 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 29, + "column": 16 + }, + "end": { + "line": 29, + "column": 17 + } + }, + "range": [ + 853, + 854 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 29, + "column": 17 + }, + "end": { + "line": 29, + "column": 24 + } + }, + "range": [ + 854, + 861 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 29, + "column": 24 + }, + "end": { + "line": 29, + "column": 25 + } + }, + "range": [ + 861, + 862 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 29, + "column": 26 + }, + "end": { + "line": 29, + "column": 39 + } + }, + "range": [ + 863, + 876 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 29, + "column": 39 + }, + "end": { + "line": 29, + "column": 40 + } + }, + "range": [ + 876, + 877 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 29, + "column": 40 + }, + "end": { + "line": 29, + "column": 41 + } + }, + "range": [ + 877, + 878 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 6 + } + }, + "range": [ + 879, + 885 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 30, + "column": 6 + }, + "end": { + "line": 30, + "column": 7 + } + }, + "range": [ + 885, + 886 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "range": [ + 886, + 895 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 30, + "column": 16 + }, + "end": { + "line": 30, + "column": 17 + } + }, + "range": [ + 895, + 896 + ] + }, + { + "type": "Identifier", + "value": "probe1", + "loc": { + "start": { + "line": 30, + "column": 17 + }, + "end": { + "line": 30, + "column": 23 + } + }, + "range": [ + 896, + 902 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 30, + "column": 23 + }, + "end": { + "line": 30, + "column": 24 + } + }, + "range": [ + 902, + 903 + ] + }, + { + "type": "String", + "value": "'first block'", + "loc": { + "start": { + "line": 30, + "column": 25 + }, + "end": { + "line": 30, + "column": 38 + } + }, + "range": [ + 904, + 917 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 30, + "column": 38 + }, + "end": { + "line": 30, + "column": 39 + } + }, + "range": [ + 917, + 918 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 30, + "column": 39 + }, + "end": { + "line": 30, + "column": 40 + } + }, + "range": [ + 918, + 919 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 6 + } + }, + "range": [ + 920, + 926 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 7 + } + }, + "range": [ + 926, + 927 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "range": [ + 927, + 936 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 31, + "column": 16 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "range": [ + 936, + 937 + ] + }, + { + "type": "Identifier", + "value": "probe2", + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 23 + } + }, + "range": [ + 937, + 943 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 31, + "column": 23 + }, + "end": { + "line": 31, + "column": 24 + } + }, + "range": [ + 943, + 944 + ] + }, + { + "type": "String", + "value": "'second block'", + "loc": { + "start": { + "line": 31, + "column": 25 + }, + "end": { + "line": 31, + "column": 39 + } + }, + "range": [ + 945, + 959 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 31, + "column": 39 + }, + "end": { + "line": 31, + "column": 40 + } + }, + "range": [ + 959, + 960 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 31, + "column": 40 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "range": [ + 960, + 961 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-open.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-open.src.js new file mode 100644 index 00000000..cc74cd53 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-lex-open.src.js @@ -0,0 +1,31 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classstaticblockdefinitionevaluation +description: Creation of new environment record for lexically-scoped bindings +info: | + ClassStaticBlock : static { ClassStaticBlockBody } + + 1. Let lex be the running execution context's LexicalEnvironment. + 2. Let privateScope be the running execution context's PrivateEnvironment. + 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope). +features: [class-static-block] +---*/ + +let test262 = 'outer scope'; +let probe1, probe2; + +class C { + static { + let test262 = 'first block'; + probe1 = test262; + } + static { + let test262 = 'second block'; + probe2 = test262; + } +} + +assert.sameValue(test262, 'outer scope'); +assert.sameValue(probe1, 'first block'); +assert.sameValue(probe2, 'second block'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-private.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-private.result.js new file mode 100644 index 00000000..3e664d60 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-private.result.js @@ -0,0 +1,985 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 25, + "column": 35 + } + }, + "range": [ + 646, + 777 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 646, + 656 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 650, + 655 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 650, + 655 + ], + "name": "probe" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "range": [ + 658, + 740 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 664, + 665 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "range": [ + 666, + 740 + ], + "body": [ + { + "type": "PropertyDefinition", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 30 + } + }, + "range": [ + 670, + 698 + ], + "static": true, + "computed": false, + "key": { + "type": "PrivateIdentifier", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 17 + } + }, + "range": [ + 677, + 685 + ], + "name": "test262" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 29 + } + }, + "range": [ + 688, + 697 + ], + "value": "private", + "raw": "'private'" + } + }, + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 702, + 738 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 23 + } + }, + "range": [ + 715, + 734 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "range": [ + 715, + 733 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 9 + } + }, + "range": [ + 715, + 720 + ], + "name": "probe" + }, + "right": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 21, + "column": 12 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "range": [ + 723, + 733 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 12 + }, + "end": { + "line": 21, + "column": 13 + } + }, + "range": [ + 723, + 724 + ], + "name": "C" + }, + "property": { + "type": "PrivateIdentifier", + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "range": [ + 725, + 733 + ], + "name": "test262" + }, + "computed": false, + "optional": false + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 35 + } + }, + "range": [ + 742, + 777 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 34 + } + }, + "range": [ + 742, + 776 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "range": [ + 742, + 758 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 6 + } + }, + "range": [ + 742, + 748 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "range": [ + 749, + 758 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 22 + } + }, + "range": [ + 759, + 764 + ], + "name": "probe" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 25, + "column": 24 + }, + "end": { + "line": 25, + "column": 33 + } + }, + "range": [ + 766, + 775 + ], + "value": "private", + "raw": "'private'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 646, + 649 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + }, + "range": [ + 650, + 655 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 655, + 656 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 5 + } + }, + "range": [ + 658, + 663 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + } + }, + "range": [ + 664, + 665 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + }, + "range": [ + 666, + 667 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 8 + } + }, + "range": [ + 670, + 676 + ] + }, + { + "type": "PrivateIdentifier", + "value": "test262", + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 17 + } + }, + "range": [ + 677, + 685 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 18, + "column": 18 + }, + "end": { + "line": 18, + "column": 19 + } + }, + "range": [ + 686, + 687 + ] + }, + { + "type": "String", + "value": "'private'", + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 29 + } + }, + "range": [ + 688, + 697 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 18, + "column": 29 + }, + "end": { + "line": 18, + "column": 30 + } + }, + "range": [ + 697, + 698 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 8 + } + }, + "range": [ + 702, + 708 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 20, + "column": 9 + }, + "end": { + "line": 20, + "column": 10 + } + }, + "range": [ + 709, + 710 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 9 + } + }, + "range": [ + 715, + 720 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 11 + } + }, + "range": [ + 721, + 722 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 21, + "column": 12 + }, + "end": { + "line": 21, + "column": 13 + } + }, + "range": [ + 723, + 724 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 14 + } + }, + "range": [ + 724, + 725 + ] + }, + { + "type": "PrivateIdentifier", + "value": "test262", + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "range": [ + 725, + 733 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 23 + } + }, + "range": [ + 733, + 734 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 737, + 738 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "range": [ + 739, + 740 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 6 + } + }, + "range": [ + 742, + 748 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 7 + } + }, + "range": [ + 748, + 749 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "range": [ + 749, + 758 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 17 + } + }, + "range": [ + 758, + 759 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 22 + } + }, + "range": [ + 759, + 764 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 23 + } + }, + "range": [ + 764, + 765 + ] + }, + { + "type": "String", + "value": "'private'", + "loc": { + "start": { + "line": 25, + "column": 24 + }, + "end": { + "line": 25, + "column": 33 + } + }, + "range": [ + 766, + 775 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 25, + "column": 33 + }, + "end": { + "line": 25, + "column": 34 + } + }, + "range": [ + 775, + 776 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 25, + "column": 34 + }, + "end": { + "line": 25, + "column": 35 + } + }, + "range": [ + 776, + 777 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-private.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-private.src.js new file mode 100644 index 00000000..849698fb --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-private.src.js @@ -0,0 +1,25 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classstaticblockdefinitionevaluation +description: Shares environment record for privately-scoped bindings +info: | + ClassStaticBlock : static { ClassStaticBlockBody } + + 1. Let lex be the running execution context's LexicalEnvironment. + 2. Let privateScope be the running execution context's PrivateEnvironment. + 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope). +features: [class-fields-private, class-static-block] +---*/ + +var probe; + +class C { + static #test262 = 'private'; + + static { + probe = C.#test262; + } +} + +assert.sameValue(probe, 'private'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-close.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-close.result.js new file mode 100644 index 00000000..de3ca4ae --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-close.result.js @@ -0,0 +1,1167 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 27, + "column": 39 + } + }, + "range": [ + 631, + 808 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 631, + 659 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 635, + 658 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 635, + 642 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 645, + 658 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 660, + 670 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 664, + 669 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 664, + 669 + ], + "name": "probe" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 672, + 767 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 678, + 679 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 680, + 767 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "range": [ + 684, + 729 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 697, + 725 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 701, + 724 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 701, + 708 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 711, + 724 + ], + "value": "first block", + "raw": "'first block'" + } + } + ], + "kind": "var" + } + ] + }, + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 732, + 765 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 20 + } + }, + "range": [ + 745, + 761 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 19 + } + }, + "range": [ + 745, + 760 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 9 + } + }, + "range": [ + 745, + 750 + ], + "name": "probe" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 19 + } + }, + "range": [ + 753, + 760 + ], + "name": "test262" + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 39 + } + }, + "range": [ + 769, + 808 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 38 + } + }, + "range": [ + 769, + 807 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 769, + 785 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 769, + 775 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 776, + 785 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "range": [ + 786, + 791 + ], + "name": "probe" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 37 + } + }, + "range": [ + 793, + 806 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 631, + 634 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 635, + 642 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 643, + 644 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 645, + 658 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 27 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 658, + 659 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 3 + } + }, + "range": [ + 660, + 663 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 664, + 669 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 669, + 670 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 5 + } + }, + "range": [ + 672, + 677 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 678, + 679 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + }, + "range": [ + 680, + 681 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 8 + } + }, + "range": [ + 684, + 690 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "range": [ + 691, + 692 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 7 + } + }, + "range": [ + 697, + 700 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 701, + 708 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 17 + } + }, + "range": [ + 709, + 710 + ] + }, + { + "type": "String", + "value": "'first block'", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 711, + 724 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 20, + "column": 31 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 724, + 725 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "range": [ + 728, + 729 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 8 + } + }, + "range": [ + 732, + 738 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 22, + "column": 10 + } + }, + "range": [ + 739, + 740 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 9 + } + }, + "range": [ + 745, + 750 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 11 + } + }, + "range": [ + 751, + 752 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 19 + } + }, + "range": [ + 753, + 760 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 23, + "column": 19 + }, + "end": { + "line": 23, + "column": 20 + } + }, + "range": [ + 760, + 761 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 3 + } + }, + "range": [ + 764, + 765 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 1 + } + }, + "range": [ + 766, + 767 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 6 + } + }, + "range": [ + 769, + 775 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "range": [ + 775, + 776 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "range": [ + 776, + 785 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "range": [ + 785, + 786 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "range": [ + 786, + 791 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 23 + } + }, + "range": [ + 791, + 792 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 37 + } + }, + "range": [ + 793, + 806 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 37 + }, + "end": { + "line": 27, + "column": 38 + } + }, + "range": [ + 806, + 807 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 27, + "column": 38 + }, + "end": { + "line": 27, + "column": 39 + } + }, + "range": [ + 807, + 808 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-close.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-close.src.js new file mode 100644 index 00000000..adc4f299 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-close.src.js @@ -0,0 +1,27 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classstaticblockdefinitionevaluation +description: Destruction of environment record for variable-scoped bindings +info: | + ClassStaticBlock : static { ClassStaticBlockBody } + + 1. Let lex be the running execution context's LexicalEnvironment. + 2. Let privateScope be the running execution context's PrivateEnvironment. + 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope). +features: [class-static-block] +---*/ + +var test262 = 'outer scope'; +var probe; + +class C { + static { + var test262 = 'first block'; + } + static { + probe = test262; + } +} + +assert.sameValue(probe, 'outer scope'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-derived.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-derived.result.js new file mode 100644 index 00000000..cca36bd9 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-derived.result.js @@ -0,0 +1,930 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 24, + "column": 39 + } + }, + "range": [ + 630, + 759 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 630, + 658 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 634, + 657 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 634, + 641 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 644, + 657 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 659, + 669 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 663, + 668 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 663, + 668 + ], + "name": "probe" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + }, + "range": [ + 671, + 718 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 677, + 678 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 22, + "column": 1 + } + }, + "range": [ + 679, + 718 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "range": [ + 683, + 716 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 20 + } + }, + "range": [ + 696, + 712 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 19 + } + }, + "range": [ + 696, + 711 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 9 + } + }, + "range": [ + 696, + 701 + ], + "name": "probe" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 19 + } + }, + "range": [ + 704, + 711 + ], + "name": "test262" + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 39 + } + }, + "range": [ + 720, + 759 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 38 + } + }, + "range": [ + 720, + 758 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "range": [ + 720, + 736 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 6 + } + }, + "range": [ + 720, + 726 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "range": [ + 727, + 736 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 22 + } + }, + "range": [ + 737, + 742 + ], + "name": "probe" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 24, + "column": 24 + }, + "end": { + "line": 24, + "column": 37 + } + }, + "range": [ + 744, + 757 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 630, + 633 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 634, + 641 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 642, + 643 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 644, + 657 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 27 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 657, + 658 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 3 + } + }, + "range": [ + 659, + 662 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 663, + 668 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 668, + 669 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 5 + } + }, + "range": [ + 671, + 676 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 677, + 678 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + }, + "range": [ + 679, + 680 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 8 + } + }, + "range": [ + 683, + 689 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "range": [ + 690, + 691 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 9 + } + }, + "range": [ + 696, + 701 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 11 + } + }, + "range": [ + 702, + 703 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 19 + } + }, + "range": [ + 704, + 711 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 20 + } + }, + "range": [ + 711, + 712 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "range": [ + 715, + 716 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + }, + "range": [ + 717, + 718 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 6 + } + }, + "range": [ + 720, + 726 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 7 + } + }, + "range": [ + 726, + 727 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "range": [ + 727, + 736 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 17 + } + }, + "range": [ + 736, + 737 + ] + }, + { + "type": "Identifier", + "value": "probe", + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 22 + } + }, + "range": [ + 737, + 742 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 24, + "column": 22 + }, + "end": { + "line": 24, + "column": 23 + } + }, + "range": [ + 742, + 743 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 24, + "column": 24 + }, + "end": { + "line": 24, + "column": 37 + } + }, + "range": [ + 744, + 757 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 24, + "column": 37 + }, + "end": { + "line": 24, + "column": 38 + } + }, + "range": [ + 757, + 758 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 24, + "column": 38 + }, + "end": { + "line": 24, + "column": 39 + } + }, + "range": [ + 758, + 759 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-derived.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-derived.src.js new file mode 100644 index 00000000..d2cf286e --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-derived.src.js @@ -0,0 +1,24 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classstaticblockdefinitionevaluation +description: Derivation of environment record for variable-scoped bindings +info: | + ClassStaticBlock : static { ClassStaticBlockBody } + + 1. Let lex be the running execution context's LexicalEnvironment. + 2. Let privateScope be the running execution context's PrivateEnvironment. + 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope). +features: [class-static-block] +---*/ + +var test262 = 'outer scope'; +var probe; + +class C { + static { + probe = test262; + } +} + +assert.sameValue(probe, 'outer scope'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-open.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-open.result.js new file mode 100644 index 00000000..6adac86f --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-open.result.js @@ -0,0 +1,2128 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "range": [ + 632, + 960 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 632, + 660 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 636, + 659 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 636, + 643 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 646, + 659 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 661, + 680 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 665, + 671 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 665, + 671 + ], + "name": "probe1" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 673, + 679 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 673, + 679 + ], + "name": "probe2" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 27, + "column": 1 + } + }, + "range": [ + 682, + 834 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 688, + 689 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 27, + "column": 1 + } + }, + "range": [ + 690, + 834 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 694, + 761 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 707, + 735 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 711, + 734 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 711, + 718 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 721, + 734 + ], + "value": "first block", + "raw": "'first block'" + } + } + ], + "kind": "var" + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 21 + } + }, + "range": [ + 740, + 757 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 20 + } + }, + "range": [ + 740, + 756 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 10 + } + }, + "range": [ + 740, + 746 + ], + "name": "probe1" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 20 + } + }, + "range": [ + 749, + 756 + ], + "name": "test262" + } + } + } + ] + }, + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 26, + "column": 3 + } + }, + "range": [ + 764, + 832 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 33 + } + }, + "range": [ + 777, + 806 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 32 + } + }, + "range": [ + 781, + 805 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 15 + } + }, + "range": [ + 781, + 788 + ], + "name": "test262" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 24, + "column": 18 + }, + "end": { + "line": 24, + "column": 32 + } + }, + "range": [ + 791, + 805 + ], + "value": "second block", + "raw": "'second block'" + } + } + ], + "kind": "var" + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 811, + 828 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 20 + } + }, + "range": [ + 811, + 827 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 10 + } + }, + "range": [ + 811, + 817 + ], + "name": "probe2" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 20 + } + }, + "range": [ + 820, + 827 + ], + "name": "test262" + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 41 + } + }, + "range": [ + 836, + 877 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 40 + } + }, + "range": [ + 836, + 876 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 16 + } + }, + "range": [ + 836, + 852 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 6 + } + }, + "range": [ + 836, + 842 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 16 + } + }, + "range": [ + 843, + 852 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 17 + }, + "end": { + "line": 29, + "column": 24 + } + }, + "range": [ + 853, + 860 + ], + "name": "test262" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 29, + "column": 26 + }, + "end": { + "line": 29, + "column": 39 + } + }, + "range": [ + 862, + 875 + ], + "value": "outer scope", + "raw": "'outer scope'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 40 + } + }, + "range": [ + 878, + 918 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 39 + } + }, + "range": [ + 878, + 917 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "range": [ + 878, + 894 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 6 + } + }, + "range": [ + 878, + 884 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "range": [ + 885, + 894 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 30, + "column": 17 + }, + "end": { + "line": 30, + "column": 23 + } + }, + "range": [ + 895, + 901 + ], + "name": "probe1" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 30, + "column": 25 + }, + "end": { + "line": 30, + "column": 38 + } + }, + "range": [ + 903, + 916 + ], + "value": "first block", + "raw": "'first block'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "range": [ + 919, + 960 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 40 + } + }, + "range": [ + 919, + 959 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "range": [ + 919, + 935 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 6 + } + }, + "range": [ + 919, + 925 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "range": [ + 926, + 935 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 23 + } + }, + "range": [ + 936, + 942 + ], + "name": "probe2" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 31, + "column": 25 + }, + "end": { + "line": 31, + "column": 39 + } + }, + "range": [ + 944, + 958 + ], + "value": "second block", + "raw": "'second block'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + }, + "range": [ + 632, + 635 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 11 + } + }, + "range": [ + 636, + 643 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + }, + "range": [ + 644, + 645 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 646, + 659 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 27 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "range": [ + 659, + 660 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 3 + } + }, + "range": [ + 661, + 664 + ] + }, + { + "type": "Identifier", + "value": "probe1", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 665, + 671 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 11 + } + }, + "range": [ + 671, + 672 + ] + }, + { + "type": "Identifier", + "value": "probe2", + "loc": { + "start": { + "line": 16, + "column": 12 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 673, + 679 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 679, + 680 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 5 + } + }, + "range": [ + 682, + 687 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 688, + 689 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + }, + "range": [ + 690, + 691 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 8 + } + }, + "range": [ + 694, + 700 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "range": [ + 701, + 702 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 7 + } + }, + "range": [ + 707, + 710 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + }, + "range": [ + 711, + 718 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 17 + } + }, + "range": [ + 719, + 720 + ] + }, + { + "type": "String", + "value": "'first block'", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 721, + 734 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 20, + "column": 31 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "range": [ + 734, + 735 + ] + }, + { + "type": "Identifier", + "value": "probe1", + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 10 + } + }, + "range": [ + 740, + 746 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 21, + "column": 11 + }, + "end": { + "line": 21, + "column": 12 + } + }, + "range": [ + 747, + 748 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 20 + } + }, + "range": [ + 749, + 756 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 21 + } + }, + "range": [ + 756, + 757 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 760, + 761 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 8 + } + }, + "range": [ + 764, + 770 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 10 + } + }, + "range": [ + 771, + 772 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 7 + } + }, + "range": [ + 777, + 780 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 15 + } + }, + "range": [ + 781, + 788 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 17 + } + }, + "range": [ + 789, + 790 + ] + }, + { + "type": "String", + "value": "'second block'", + "loc": { + "start": { + "line": 24, + "column": 18 + }, + "end": { + "line": 24, + "column": 32 + } + }, + "range": [ + 791, + 805 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 24, + "column": 32 + }, + "end": { + "line": 24, + "column": 33 + } + }, + "range": [ + 805, + 806 + ] + }, + { + "type": "Identifier", + "value": "probe2", + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 10 + } + }, + "range": [ + 811, + 817 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 12 + } + }, + "range": [ + 818, + 819 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 20 + } + }, + "range": [ + 820, + 827 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 25, + "column": 20 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 827, + 828 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 3 + } + }, + "range": [ + 831, + 832 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 1 + } + }, + "range": [ + 833, + 834 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 6 + } + }, + "range": [ + 836, + 842 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 29, + "column": 6 + }, + "end": { + "line": 29, + "column": 7 + } + }, + "range": [ + 842, + 843 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 16 + } + }, + "range": [ + 843, + 852 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 29, + "column": 16 + }, + "end": { + "line": 29, + "column": 17 + } + }, + "range": [ + 852, + 853 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 29, + "column": 17 + }, + "end": { + "line": 29, + "column": 24 + } + }, + "range": [ + 853, + 860 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 29, + "column": 24 + }, + "end": { + "line": 29, + "column": 25 + } + }, + "range": [ + 860, + 861 + ] + }, + { + "type": "String", + "value": "'outer scope'", + "loc": { + "start": { + "line": 29, + "column": 26 + }, + "end": { + "line": 29, + "column": 39 + } + }, + "range": [ + 862, + 875 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 29, + "column": 39 + }, + "end": { + "line": 29, + "column": 40 + } + }, + "range": [ + 875, + 876 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 29, + "column": 40 + }, + "end": { + "line": 29, + "column": 41 + } + }, + "range": [ + 876, + 877 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 6 + } + }, + "range": [ + 878, + 884 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 30, + "column": 6 + }, + "end": { + "line": 30, + "column": 7 + } + }, + "range": [ + 884, + 885 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "range": [ + 885, + 894 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 30, + "column": 16 + }, + "end": { + "line": 30, + "column": 17 + } + }, + "range": [ + 894, + 895 + ] + }, + { + "type": "Identifier", + "value": "probe1", + "loc": { + "start": { + "line": 30, + "column": 17 + }, + "end": { + "line": 30, + "column": 23 + } + }, + "range": [ + 895, + 901 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 30, + "column": 23 + }, + "end": { + "line": 30, + "column": 24 + } + }, + "range": [ + 901, + 902 + ] + }, + { + "type": "String", + "value": "'first block'", + "loc": { + "start": { + "line": 30, + "column": 25 + }, + "end": { + "line": 30, + "column": 38 + } + }, + "range": [ + 903, + 916 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 30, + "column": 38 + }, + "end": { + "line": 30, + "column": 39 + } + }, + "range": [ + 916, + 917 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 30, + "column": 39 + }, + "end": { + "line": 30, + "column": 40 + } + }, + "range": [ + 917, + 918 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 6 + } + }, + "range": [ + 919, + 925 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 7 + } + }, + "range": [ + 925, + 926 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "range": [ + 926, + 935 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 31, + "column": 16 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "range": [ + 935, + 936 + ] + }, + { + "type": "Identifier", + "value": "probe2", + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 23 + } + }, + "range": [ + 936, + 942 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 31, + "column": 23 + }, + "end": { + "line": 31, + "column": 24 + } + }, + "range": [ + 942, + 943 + ] + }, + { + "type": "String", + "value": "'second block'", + "loc": { + "start": { + "line": 31, + "column": 25 + }, + "end": { + "line": 31, + "column": 39 + } + }, + "range": [ + 944, + 958 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 31, + "column": 39 + }, + "end": { + "line": 31, + "column": 40 + } + }, + "range": [ + 958, + 959 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 31, + "column": 40 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "range": [ + 959, + 960 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-open.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-open.src.js new file mode 100644 index 00000000..b8152112 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-scope-var-open.src.js @@ -0,0 +1,31 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classstaticblockdefinitionevaluation +description: Creation of new environment record for variable-scoped bindings +info: | + ClassStaticBlock : static { ClassStaticBlockBody } + + 1. Let lex be the running execution context's LexicalEnvironment. + 2. Let privateScope be the running execution context's PrivateEnvironment. + 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope). +features: [class-static-block] +---*/ + +var test262 = 'outer scope'; +var probe1, probe2; + +class C { + static { + var test262 = 'first block'; + probe1 = test262; + } + static { + var test262 = 'second block'; + probe2 = test262; + } +} + +assert.sameValue(test262, 'outer scope'); +assert.sameValue(probe1, 'first block'); +assert.sameValue(probe2, 'second block'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-sequence.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-sequence.result.js new file mode 100644 index 00000000..d78610b4 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-sequence.result.js @@ -0,0 +1,3104 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 38, + "column": 46 + } + }, + "range": [ + 870, + 1274 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 18 + } + }, + "range": [ + 870, + 888 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 17 + } + }, + "range": [ + 874, + 887 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 12 + } + }, + "range": [ + 874, + 882 + ], + "name": "sequence" + }, + "init": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 17 + } + }, + "range": [ + 885, + 887 + ], + "elements": [] + } + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 33, + "column": 1 + } + }, + "range": [ + 890, + 1087 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 7 + } + }, + "range": [ + 896, + 897 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 33, + "column": 1 + } + }, + "range": [ + 898, + 1087 + ], + "body": [ + { + "type": "PropertyDefinition", + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 42 + } + }, + "range": [ + 902, + 942 + ], + "static": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 9 + }, + "end": { + "line": 25, + "column": 10 + } + }, + "range": [ + 909, + 910 + ], + "name": "x" + }, + "value": { + "type": "CallExpression", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 41 + } + }, + "range": [ + 913, + 941 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "range": [ + 913, + 926 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 913, + 921 + ], + "name": "sequence" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "range": [ + 922, + 926 + ], + "name": "push" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 40 + } + }, + "range": [ + 927, + 940 + ], + "value": "first field", + "raw": "'first field'" + } + ], + "optional": false + } + }, + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + }, + "range": [ + 945, + 991 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 33 + } + }, + "range": [ + 958, + 987 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 32 + } + }, + "range": [ + 958, + 986 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "range": [ + 958, + 971 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 12 + } + }, + "range": [ + 958, + 966 + ], + "name": "sequence" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 27, + "column": 13 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "range": [ + 967, + 971 + ], + "name": "push" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 27, + "column": 18 + }, + "end": { + "line": 27, + "column": 31 + } + }, + "range": [ + 972, + 985 + ], + "value": "first block", + "raw": "'first block'" + } + ], + "optional": false + } + } + ] + }, + { + "type": "PropertyDefinition", + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 43 + } + }, + "range": [ + 994, + 1035 + ], + "static": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + } + }, + "range": [ + 1001, + 1002 + ], + "name": "x" + }, + "value": { + "type": "CallExpression", + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 29, + "column": 42 + } + }, + "range": [ + 1005, + 1034 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "range": [ + 1005, + 1018 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 29, + "column": 21 + } + }, + "range": [ + 1005, + 1013 + ], + "name": "sequence" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 29, + "column": 22 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "range": [ + 1014, + 1018 + ], + "name": "push" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 41 + } + }, + "range": [ + 1019, + 1033 + ], + "value": "second field", + "raw": "'second field'" + } + ], + "optional": false + } + }, + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 32, + "column": 3 + } + }, + "range": [ + 1038, + 1085 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 31, + "column": 4 + }, + "end": { + "line": 31, + "column": 34 + } + }, + "range": [ + 1051, + 1081 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 31, + "column": 4 + }, + "end": { + "line": 31, + "column": 33 + } + }, + "range": [ + 1051, + 1080 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 31, + "column": 4 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "range": [ + 1051, + 1064 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 4 + }, + "end": { + "line": 31, + "column": 12 + } + }, + "range": [ + 1051, + 1059 + ], + "name": "sequence" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "range": [ + 1060, + 1064 + ], + "name": "push" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 31, + "column": 18 + }, + "end": { + "line": 31, + "column": 32 + } + }, + "range": [ + 1065, + 1079 + ], + "value": "second block", + "raw": "'second block'" + } + ], + "optional": false + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 45 + } + }, + "range": [ + 1089, + 1134 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 44 + } + }, + "range": [ + 1089, + 1133 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 16 + } + }, + "range": [ + 1089, + 1105 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 6 + } + }, + "range": [ + 1089, + 1095 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 35, + "column": 7 + }, + "end": { + "line": 35, + "column": 16 + } + }, + "range": [ + 1096, + 1105 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "MemberExpression", + "loc": { + "start": { + "line": 35, + "column": 17 + }, + "end": { + "line": 35, + "column": 28 + } + }, + "range": [ + 1106, + 1117 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 35, + "column": 17 + }, + "end": { + "line": 35, + "column": 25 + } + }, + "range": [ + 1106, + 1114 + ], + "name": "sequence" + }, + "property": { + "type": "Literal", + "loc": { + "start": { + "line": 35, + "column": 26 + }, + "end": { + "line": 35, + "column": 27 + } + }, + "range": [ + 1115, + 1116 + ], + "value": 0, + "raw": "0" + }, + "computed": true, + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 35, + "column": 30 + }, + "end": { + "line": 35, + "column": 43 + } + }, + "range": [ + 1119, + 1132 + ], + "value": "first field", + "raw": "'first field'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 45 + } + }, + "range": [ + 1135, + 1180 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 44 + } + }, + "range": [ + 1135, + 1179 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 16 + } + }, + "range": [ + 1135, + 1151 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 6 + } + }, + "range": [ + 1135, + 1141 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 36, + "column": 7 + }, + "end": { + "line": 36, + "column": 16 + } + }, + "range": [ + 1142, + 1151 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "MemberExpression", + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 28 + } + }, + "range": [ + 1152, + 1163 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 25 + } + }, + "range": [ + 1152, + 1160 + ], + "name": "sequence" + }, + "property": { + "type": "Literal", + "loc": { + "start": { + "line": 36, + "column": 26 + }, + "end": { + "line": 36, + "column": 27 + } + }, + "range": [ + 1161, + 1162 + ], + "value": 1, + "raw": "1" + }, + "computed": true, + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 36, + "column": 30 + }, + "end": { + "line": 36, + "column": 43 + } + }, + "range": [ + 1165, + 1178 + ], + "value": "first block", + "raw": "'first block'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 46 + } + }, + "range": [ + 1181, + 1227 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 45 + } + }, + "range": [ + 1181, + 1226 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 16 + } + }, + "range": [ + 1181, + 1197 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 6 + } + }, + "range": [ + 1181, + 1187 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 7 + }, + "end": { + "line": 37, + "column": 16 + } + }, + "range": [ + 1188, + 1197 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "MemberExpression", + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 28 + } + }, + "range": [ + 1198, + 1209 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 25 + } + }, + "range": [ + 1198, + 1206 + ], + "name": "sequence" + }, + "property": { + "type": "Literal", + "loc": { + "start": { + "line": 37, + "column": 26 + }, + "end": { + "line": 37, + "column": 27 + } + }, + "range": [ + 1207, + 1208 + ], + "value": 2, + "raw": "2" + }, + "computed": true, + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 37, + "column": 30 + }, + "end": { + "line": 37, + "column": 44 + } + }, + "range": [ + 1211, + 1225 + ], + "value": "second field", + "raw": "'second field'" + } + ], + "optional": false + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 46 + } + }, + "range": [ + 1228, + 1274 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 45 + } + }, + "range": [ + 1228, + 1273 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 16 + } + }, + "range": [ + 1228, + 1244 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 6 + } + }, + "range": [ + 1228, + 1234 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 16 + } + }, + "range": [ + 1235, + 1244 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "MemberExpression", + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 28 + } + }, + "range": [ + 1245, + 1256 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 25 + } + }, + "range": [ + 1245, + 1253 + ], + "name": "sequence" + }, + "property": { + "type": "Literal", + "loc": { + "start": { + "line": 38, + "column": 26 + }, + "end": { + "line": 38, + "column": 27 + } + }, + "range": [ + 1254, + 1255 + ], + "value": 3, + "raw": "3" + }, + "computed": true, + "optional": false + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 38, + "column": 30 + }, + "end": { + "line": 38, + "column": 44 + } + }, + "range": [ + 1258, + 1272 + ], + "value": "second block", + "raw": "'second block'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + }, + "range": [ + 870, + 873 + ] + }, + { + "type": "Identifier", + "value": "sequence", + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 12 + } + }, + "range": [ + 874, + 882 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 22, + "column": 13 + }, + "end": { + "line": 22, + "column": 14 + } + }, + "range": [ + 883, + 884 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 16 + } + }, + "range": [ + 885, + 886 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 22, + "column": 16 + }, + "end": { + "line": 22, + "column": 17 + } + }, + "range": [ + 886, + 887 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 18 + } + }, + "range": [ + 887, + 888 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 5 + } + }, + "range": [ + 890, + 895 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 7 + } + }, + "range": [ + 896, + 897 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + }, + "range": [ + 898, + 899 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 8 + } + }, + "range": [ + 902, + 908 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 25, + "column": 9 + }, + "end": { + "line": 25, + "column": 10 + } + }, + "range": [ + 909, + 910 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 12 + } + }, + "range": [ + 911, + 912 + ] + }, + { + "type": "Identifier", + "value": "sequence", + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "range": [ + 913, + 921 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 22 + } + }, + "range": [ + 921, + 922 + ] + }, + { + "type": "Identifier", + "value": "push", + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "range": [ + 922, + 926 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "range": [ + 926, + 927 + ] + }, + { + "type": "String", + "value": "'first field'", + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 40 + } + }, + "range": [ + 927, + 940 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 25, + "column": 40 + }, + "end": { + "line": 25, + "column": 41 + } + }, + "range": [ + 940, + 941 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 25, + "column": 41 + }, + "end": { + "line": 25, + "column": 42 + } + }, + "range": [ + 941, + 942 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 8 + } + }, + "range": [ + 945, + 951 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 26, + "column": 9 + }, + "end": { + "line": 26, + "column": 10 + } + }, + "range": [ + 952, + 953 + ] + }, + { + "type": "Identifier", + "value": "sequence", + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 12 + } + }, + "range": [ + 958, + 966 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 27, + "column": 13 + } + }, + "range": [ + 966, + 967 + ] + }, + { + "type": "Identifier", + "value": "push", + "loc": { + "start": { + "line": 27, + "column": 13 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "range": [ + 967, + 971 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 27, + "column": 17 + }, + "end": { + "line": 27, + "column": 18 + } + }, + "range": [ + 971, + 972 + ] + }, + { + "type": "String", + "value": "'first block'", + "loc": { + "start": { + "line": 27, + "column": 18 + }, + "end": { + "line": 27, + "column": 31 + } + }, + "range": [ + 972, + 985 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 32 + } + }, + "range": [ + 985, + 986 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 27, + "column": 32 + }, + "end": { + "line": 27, + "column": 33 + } + }, + "range": [ + 986, + 987 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + }, + "range": [ + 990, + 991 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 8 + } + }, + "range": [ + 994, + 1000 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + } + }, + "range": [ + 1001, + 1002 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 12 + } + }, + "range": [ + 1003, + 1004 + ] + }, + { + "type": "Identifier", + "value": "sequence", + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 29, + "column": 21 + } + }, + "range": [ + 1005, + 1013 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 29, + "column": 21 + }, + "end": { + "line": 29, + "column": 22 + } + }, + "range": [ + 1013, + 1014 + ] + }, + { + "type": "Identifier", + "value": "push", + "loc": { + "start": { + "line": 29, + "column": 22 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "range": [ + 1014, + 1018 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 29, + "column": 26 + }, + "end": { + "line": 29, + "column": 27 + } + }, + "range": [ + 1018, + 1019 + ] + }, + { + "type": "String", + "value": "'second field'", + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 41 + } + }, + "range": [ + 1019, + 1033 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 29, + "column": 41 + }, + "end": { + "line": 29, + "column": 42 + } + }, + "range": [ + 1033, + 1034 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 29, + "column": 42 + }, + "end": { + "line": 29, + "column": 43 + } + }, + "range": [ + 1034, + 1035 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 8 + } + }, + "range": [ + 1038, + 1044 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 30, + "column": 9 + }, + "end": { + "line": 30, + "column": 10 + } + }, + "range": [ + 1045, + 1046 + ] + }, + { + "type": "Identifier", + "value": "sequence", + "loc": { + "start": { + "line": 31, + "column": 4 + }, + "end": { + "line": 31, + "column": 12 + } + }, + "range": [ + 1051, + 1059 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 13 + } + }, + "range": [ + 1059, + 1060 + ] + }, + { + "type": "Identifier", + "value": "push", + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "range": [ + 1060, + 1064 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 18 + } + }, + "range": [ + 1064, + 1065 + ] + }, + { + "type": "String", + "value": "'second block'", + "loc": { + "start": { + "line": 31, + "column": 18 + }, + "end": { + "line": 31, + "column": 32 + } + }, + "range": [ + 1065, + 1079 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 31, + "column": 32 + }, + "end": { + "line": 31, + "column": 33 + } + }, + "range": [ + 1079, + 1080 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 31, + "column": 33 + }, + "end": { + "line": 31, + "column": 34 + } + }, + "range": [ + 1080, + 1081 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 3 + } + }, + "range": [ + 1084, + 1085 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 33, + "column": 0 + }, + "end": { + "line": 33, + "column": 1 + } + }, + "range": [ + 1086, + 1087 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 6 + } + }, + "range": [ + 1089, + 1095 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 35, + "column": 6 + }, + "end": { + "line": 35, + "column": 7 + } + }, + "range": [ + 1095, + 1096 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 35, + "column": 7 + }, + "end": { + "line": 35, + "column": 16 + } + }, + "range": [ + 1096, + 1105 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 35, + "column": 16 + }, + "end": { + "line": 35, + "column": 17 + } + }, + "range": [ + 1105, + 1106 + ] + }, + { + "type": "Identifier", + "value": "sequence", + "loc": { + "start": { + "line": 35, + "column": 17 + }, + "end": { + "line": 35, + "column": 25 + } + }, + "range": [ + 1106, + 1114 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 35, + "column": 25 + }, + "end": { + "line": 35, + "column": 26 + } + }, + "range": [ + 1114, + 1115 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 35, + "column": 26 + }, + "end": { + "line": 35, + "column": 27 + } + }, + "range": [ + 1115, + 1116 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 35, + "column": 27 + }, + "end": { + "line": 35, + "column": 28 + } + }, + "range": [ + 1116, + 1117 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 35, + "column": 28 + }, + "end": { + "line": 35, + "column": 29 + } + }, + "range": [ + 1117, + 1118 + ] + }, + { + "type": "String", + "value": "'first field'", + "loc": { + "start": { + "line": 35, + "column": 30 + }, + "end": { + "line": 35, + "column": 43 + } + }, + "range": [ + 1119, + 1132 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 35, + "column": 43 + }, + "end": { + "line": 35, + "column": 44 + } + }, + "range": [ + 1132, + 1133 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 35, + "column": 44 + }, + "end": { + "line": 35, + "column": 45 + } + }, + "range": [ + 1133, + 1134 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 6 + } + }, + "range": [ + 1135, + 1141 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 36, + "column": 6 + }, + "end": { + "line": 36, + "column": 7 + } + }, + "range": [ + 1141, + 1142 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 36, + "column": 7 + }, + "end": { + "line": 36, + "column": 16 + } + }, + "range": [ + 1142, + 1151 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 36, + "column": 16 + }, + "end": { + "line": 36, + "column": 17 + } + }, + "range": [ + 1151, + 1152 + ] + }, + { + "type": "Identifier", + "value": "sequence", + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 25 + } + }, + "range": [ + 1152, + 1160 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 36, + "column": 25 + }, + "end": { + "line": 36, + "column": 26 + } + }, + "range": [ + 1160, + 1161 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 36, + "column": 26 + }, + "end": { + "line": 36, + "column": 27 + } + }, + "range": [ + 1161, + 1162 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 36, + "column": 27 + }, + "end": { + "line": 36, + "column": 28 + } + }, + "range": [ + 1162, + 1163 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 36, + "column": 28 + }, + "end": { + "line": 36, + "column": 29 + } + }, + "range": [ + 1163, + 1164 + ] + }, + { + "type": "String", + "value": "'first block'", + "loc": { + "start": { + "line": 36, + "column": 30 + }, + "end": { + "line": 36, + "column": 43 + } + }, + "range": [ + 1165, + 1178 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 36, + "column": 43 + }, + "end": { + "line": 36, + "column": 44 + } + }, + "range": [ + 1178, + 1179 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 36, + "column": 44 + }, + "end": { + "line": 36, + "column": 45 + } + }, + "range": [ + 1179, + 1180 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 6 + } + }, + "range": [ + 1181, + 1187 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 7 + } + }, + "range": [ + 1187, + 1188 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 37, + "column": 7 + }, + "end": { + "line": 37, + "column": 16 + } + }, + "range": [ + 1188, + 1197 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 37, + "column": 16 + }, + "end": { + "line": 37, + "column": 17 + } + }, + "range": [ + 1197, + 1198 + ] + }, + { + "type": "Identifier", + "value": "sequence", + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 25 + } + }, + "range": [ + 1198, + 1206 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 37, + "column": 25 + }, + "end": { + "line": 37, + "column": 26 + } + }, + "range": [ + 1206, + 1207 + ] + }, + { + "type": "Numeric", + "value": "2", + "loc": { + "start": { + "line": 37, + "column": 26 + }, + "end": { + "line": 37, + "column": 27 + } + }, + "range": [ + 1207, + 1208 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 37, + "column": 27 + }, + "end": { + "line": 37, + "column": 28 + } + }, + "range": [ + 1208, + 1209 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 37, + "column": 28 + }, + "end": { + "line": 37, + "column": 29 + } + }, + "range": [ + 1209, + 1210 + ] + }, + { + "type": "String", + "value": "'second field'", + "loc": { + "start": { + "line": 37, + "column": 30 + }, + "end": { + "line": 37, + "column": 44 + } + }, + "range": [ + 1211, + 1225 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 37, + "column": 44 + }, + "end": { + "line": 37, + "column": 45 + } + }, + "range": [ + 1225, + 1226 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 37, + "column": 45 + }, + "end": { + "line": 37, + "column": 46 + } + }, + "range": [ + 1226, + 1227 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 6 + } + }, + "range": [ + 1228, + 1234 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 38, + "column": 6 + }, + "end": { + "line": 38, + "column": 7 + } + }, + "range": [ + 1234, + 1235 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 16 + } + }, + "range": [ + 1235, + 1244 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 38, + "column": 16 + }, + "end": { + "line": 38, + "column": 17 + } + }, + "range": [ + 1244, + 1245 + ] + }, + { + "type": "Identifier", + "value": "sequence", + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 25 + } + }, + "range": [ + 1245, + 1253 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 38, + "column": 25 + }, + "end": { + "line": 38, + "column": 26 + } + }, + "range": [ + 1253, + 1254 + ] + }, + { + "type": "Numeric", + "value": "3", + "loc": { + "start": { + "line": 38, + "column": 26 + }, + "end": { + "line": 38, + "column": 27 + } + }, + "range": [ + 1254, + 1255 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 38, + "column": 27 + }, + "end": { + "line": 38, + "column": 28 + } + }, + "range": [ + 1255, + 1256 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 38, + "column": 28 + }, + "end": { + "line": 38, + "column": 29 + } + }, + "range": [ + 1256, + 1257 + ] + }, + { + "type": "String", + "value": "'second block'", + "loc": { + "start": { + "line": 38, + "column": 30 + }, + "end": { + "line": 38, + "column": 44 + } + }, + "range": [ + 1258, + 1272 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 38, + "column": 44 + }, + "end": { + "line": 38, + "column": 45 + } + }, + "range": [ + 1272, + 1273 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 38, + "column": 45 + }, + "end": { + "line": 38, + "column": 46 + } + }, + "range": [ + 1273, + 1274 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-sequence.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-sequence.src.js new file mode 100644 index 00000000..335dc9dd --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-sequence.src.js @@ -0,0 +1,38 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classelementevaluation +description: Static blocks are evaluated in the order they appear in the source text, interleaved with static fields +info: | + 5.1.14 Runtime Semantics: ClassDefinitionEvaluation + + [...] + 34. For each element elementRecord of staticElements in List order, do + a. If elementRecord is a ClassFieldDefinition Record, then + i. Let status be the result of performing DefineField(F, + elementRecord). + b. Else, + i. Assert: fieldRecord is a ClassStaticBlockDefinition Record. + ii. Let status be the result of performing EvaluateStaticBlock(F, + elementRecord). + [...] +features: [class-static-fields-public, class-static-block] +---*/ + +var sequence = []; + +class C { + static x = sequence.push('first field'); + static { + sequence.push('first block'); + } + static x = sequence.push('second field'); + static { + sequence.push('second block'); + } +} + +assert.sameValue(sequence[0], 'first field'); +assert.sameValue(sequence[1], 'first block'); +assert.sameValue(sequence[2], 'second field'); +assert.sameValue(sequence[3], 'second block'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-statement-list-optional.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-statement-list-optional.result.js new file mode 100644 index 00000000..a72e9803 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-statement-list-optional.result.js @@ -0,0 +1,221 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 370, + 393 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 370, + 393 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 376, + 377 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 378, + 393 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 11 + } + }, + "range": [ + 382, + 391 + ], + "body": [] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 370, + 375 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 376, + 377 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 378, + 379 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 8 + } + }, + "range": [ + 382, + 388 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 10 + } + }, + "range": [ + 389, + 390 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 11 + } + }, + "range": [ + 390, + 391 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 392, + 393 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-statement-list-optional.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-statement-list-optional.src.js new file mode 100644 index 00000000..038f1bf2 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-statement-list-optional.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions +description: The block's statement list is optional +info: | + Syntax + + [...] + + ClassStaticBlockStatementList : + StatementList[~Yield, +Await, ~Return]opt +features: [class-static-block] +---*/ + +class C { + static {} +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-super-property.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-super-property.result.js new file mode 100644 index 00000000..026d88fe --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-super-property.result.js @@ -0,0 +1,1273 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 24, + "column": 35 + } + }, + "range": [ + 449, + 615 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 20 + } + }, + "range": [ + 449, + 469 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 15 + } + }, + "range": [ + 458, + 464 + ], + "name": "Parent" + }, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 20 + } + }, + "range": [ + 467, + 469 + ], + "body": [] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 470, + 497 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "range": [ + 470, + 496 + ], + "operator": "=", + "left": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 14 + } + }, + "range": [ + 470, + 484 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 6 + } + }, + "range": [ + 470, + 476 + ], + "name": "Parent" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + }, + "range": [ + 477, + 484 + ], + "name": "test262" + }, + "computed": false, + "optional": false + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "range": [ + 487, + 496 + ], + "value": "test262", + "raw": "'test262'" + } + } + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 498, + 508 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 502, + 507 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 502, + 507 + ], + "name": "value" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + }, + "range": [ + 510, + 578 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 516, + 517 + ], + "name": "C" + }, + "superClass": { + "type": "Identifier", + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 22 + } + }, + "range": [ + 526, + 532 + ], + "name": "Parent" + }, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 22, + "column": 1 + } + }, + "range": [ + 533, + 578 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "range": [ + 537, + 576 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 26 + } + }, + "range": [ + 550, + 572 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "range": [ + 550, + 571 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 9 + } + }, + "range": [ + 550, + 555 + ], + "name": "value" + }, + "right": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "range": [ + 558, + 571 + ], + "object": { + "type": "Super", + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 17 + } + }, + "range": [ + 558, + 563 + ] + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "range": [ + 564, + 571 + ], + "name": "test262" + }, + "computed": false, + "optional": false + } + } + } + ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 35 + } + }, + "range": [ + 580, + 615 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 34 + } + }, + "range": [ + 580, + 614 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "range": [ + 580, + 596 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 6 + } + }, + "range": [ + 580, + 586 + ], + "name": "assert" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "range": [ + 587, + 596 + ], + "name": "sameValue" + }, + "computed": false, + "optional": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 22 + } + }, + "range": [ + 597, + 602 + ], + "name": "value" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 24, + "column": 24 + }, + "end": { + "line": 24, + "column": 33 + } + }, + "range": [ + 604, + 613 + ], + "value": "test262", + "raw": "'test262'" + } + ], + "optional": false + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 8 + } + }, + "range": [ + 449, + 457 + ] + }, + { + "type": "Identifier", + "value": "Parent", + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 15 + } + }, + "range": [ + 458, + 464 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + }, + "range": [ + 464, + 465 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 17 + } + }, + "range": [ + 465, + 466 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 19 + } + }, + "range": [ + 467, + 468 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + }, + "range": [ + 468, + 469 + ] + }, + { + "type": "Identifier", + "value": "Parent", + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 6 + } + }, + "range": [ + 470, + 476 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 7 + } + }, + "range": [ + 476, + 477 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 14 + } + }, + "range": [ + 477, + 484 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "range": [ + 485, + 486 + ] + }, + { + "type": "String", + "value": "'test262'", + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "range": [ + 487, + 496 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 15, + "column": 26 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 3 + } + }, + "range": [ + 498, + 501 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 9 + } + }, + "range": [ + 502, + 507 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 507, + 508 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 5 + } + }, + "range": [ + 510, + 515 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Keyword", + "value": "extends", + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 15 + } + }, + "range": [ + 518, + 525 + ] + }, + { + "type": "Identifier", + "value": "Parent", + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 22 + } + }, + "range": [ + 526, + 532 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + }, + "range": [ + 533, + 534 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 8 + } + }, + "range": [ + 537, + 543 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "range": [ + 544, + 545 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 9 + } + }, + "range": [ + 550, + 555 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 11 + } + }, + "range": [ + 556, + 557 + ] + }, + { + "type": "Keyword", + "value": "super", + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 17 + } + }, + "range": [ + 558, + 563 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 18 + } + }, + "range": [ + 563, + 564 + ] + }, + { + "type": "Identifier", + "value": "test262", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "range": [ + 564, + 571 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 26 + } + }, + "range": [ + 571, + 572 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "range": [ + 575, + 576 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + }, + "range": [ + 577, + 578 + ] + }, + { + "type": "Identifier", + "value": "assert", + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 6 + } + }, + "range": [ + 580, + 586 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 7 + } + }, + "range": [ + 586, + 587 + ] + }, + { + "type": "Identifier", + "value": "sameValue", + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "range": [ + 587, + 596 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 17 + } + }, + "range": [ + 596, + 597 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 22 + } + }, + "range": [ + 597, + 602 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 24, + "column": 22 + }, + "end": { + "line": 24, + "column": 23 + } + }, + "range": [ + 602, + 603 + ] + }, + { + "type": "String", + "value": "'test262'", + "loc": { + "start": { + "line": 24, + "column": 24 + }, + "end": { + "line": 24, + "column": 33 + } + }, + "range": [ + 604, + 613 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 24, + "column": 33 + }, + "end": { + "line": 24, + "column": 34 + } + }, + "range": [ + 613, + 614 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 24, + "column": 34 + }, + "end": { + "line": 24, + "column": 35 + } + }, + "range": [ + 614, + 615 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-super-property.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-super-property.src.js new file mode 100644 index 00000000..ebfc5f60 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-class-static-init-super-property.src.js @@ -0,0 +1,24 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classstaticblockdefinitionevaluation +description: The home object for a class static initialization block is the parent class +info: | + ClassStaticBlock : static { ClassStaticBlockBody } + + [...] + 4. Perform MakeMethod(body, homeObject). +features: [class-static-block] +---*/ + +function Parent() {} +Parent.test262 = 'test262'; +var value; + +class C extends Parent { + static { + value = super.test262; + } +} + +assert.sameValue(value, 'test262'); diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-invalid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-invalid.result.js new file mode 100644 index 00000000..7895ae92 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-invalid.result.js @@ -0,0 +1,6 @@ +export default { + "index": 715, + "lineNumber": 24, + "column": 11, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-invalid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-invalid.src.js new file mode 100644 index 00000000..f3ddd377 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-invalid.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: BindingIdentifier may not be `await` within class static blocks +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + const await = 0; + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.module-result.js new file mode 100644 index 00000000..f3d6219c --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 530, + "lineNumber": 16, + "column": 20, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.result.js new file mode 100644 index 00000000..440fac84 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.result.js @@ -0,0 +1,588 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 550 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 550 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 550 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 502, + 548 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 33 + } + }, + "range": [ + 515, + 544 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 516, + 542 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 522, + 542 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 524, + 540 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 530, + 539 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 530, + 535 + ], + "name": "await" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 538, + 539 + ], + "value": 0, + "raw": "0" + } + } + ], + "kind": "const" + } + ] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 490, + 495 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 502, + 508 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 509, + 510 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 515, + 516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 519, + 521 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 524, + 529 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 530, + 535 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "range": [ + 536, + 537 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 538, + 539 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 539, + 540 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 30 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 541, + 542 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 32 + }, + "end": { + "line": 16, + "column": 33 + } + }, + "range": [ + 543, + 544 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 547, + 548 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 549, + 550 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.src.js new file mode 100644 index 00000000..64592782 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-const-static-init-await-binding-valid.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within arrow function bodies +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => { const await = 0; }); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-with-label.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-with-label.result.js new file mode 100644 index 00000000..a9af2718 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-with-label.result.js @@ -0,0 +1,6 @@ +export default { + "index": 780, + "lineNumber": 25, + "column": 7, + "message": "Unsyntactic continue" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-with-label.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-with-label.src.js new file mode 100644 index 00000000..ef9e5cc8 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-with-label.src.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-continue-statement +description: IterationStatement search does not traverse static initialization block boundaries (label specified) +info: | + 4.1.1 Static Semantics: Early Errors + ContinueStatement : continue ; + ContinueStatement : continue LabelIdentifier ; + + - It is a Syntax Error if this ContinueStatement is not nested, directly or + indirectly (but not crossing function or static initialization block + boundaries), within an IterationStatement. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +label: while(false) { + class C { + static { + continue label; + } + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-without-label.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-without-label.result.js new file mode 100644 index 00000000..cbf96dcd --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-without-label.result.js @@ -0,0 +1,6 @@ +export default { + "index": 783, + "lineNumber": 25, + "column": 7, + "message": "Unsyntactic continue" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-without-label.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-without-label.src.js new file mode 100644 index 00000000..ac225931 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-continue-static-init-without-label.src.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-continue-statement +description: IterationStatement search does not traverse static initialization block boundaries (no label specified) +info: | + 4.1.1 Static Semantics: Early Errors + ContinueStatement : continue ; + ContinueStatement : continue LabelIdentifier ; + + - It is a Syntax Error if this ContinueStatement is not nested, directly or + indirectly (but not crossing function or static initialization block + boundaries), within an IterationStatement. +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +label: while(false) { + class C { + static { + continue; + } + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-invalid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-invalid.result.js new file mode 100644 index 00000000..8c9fe9b1 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-invalid.result.js @@ -0,0 +1,6 @@ +export default { + "index": 718, + "lineNumber": 24, + "column": 14, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-invalid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-invalid.src.js new file mode 100644 index 00000000..96c04d8f --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-invalid.src.js @@ -0,0 +1,27 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: BindingIdentifier may not be `await` within class static blocks +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + function await() {} + } +} + diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.module-result.js new file mode 100644 index 00000000..ac3f4e7f --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 533, + "lineNumber": 16, + "column": 23, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.result.js new file mode 100644 index 00000000..e8c32bde --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.result.js @@ -0,0 +1,589 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 553 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 553 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 553 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 502, + 551 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 36 + } + }, + "range": [ + 515, + 547 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 34 + } + }, + "range": [ + 516, + 545 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 34 + } + }, + "range": [ + 522, + 545 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 524, + 543 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 533, + 538 + ], + "name": "await" + }, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 30 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 541, + 543 + ], + "body": [] + } + } + ] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 490, + 495 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 502, + 508 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 509, + 510 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 515, + 516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 519, + 521 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 21 + } + }, + "range": [ + 524, + 532 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 533, + 538 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 538, + 539 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 539, + 540 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 30 + }, + "end": { + "line": 16, + "column": 31 + } + }, + "range": [ + 541, + 542 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 33 + }, + "end": { + "line": 16, + "column": 34 + } + }, + "range": [ + 544, + 545 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 34 + }, + "end": { + "line": 16, + "column": 35 + } + }, + "range": [ + 545, + 546 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 35 + }, + "end": { + "line": 16, + "column": 36 + } + }, + "range": [ + 546, + 547 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 550, + 551 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 552, + 553 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.src.js new file mode 100644 index 00000000..fb086826 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-function-static-init-await-binding-valid.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within arrow function bodies +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => { function await() {} }); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-labeled-static-init-invalid-await.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-labeled-static-init-invalid-await.result.js new file mode 100644 index 00000000..921bd594 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-labeled-static-init-invalid-await.result.js @@ -0,0 +1,6 @@ +export default { + "index": 658, + "lineNumber": 23, + "column": 5, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-labeled-static-init-invalid-await.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-labeled-static-init-invalid-await.src.js new file mode 100644 index 00000000..e6b38ae7 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-labeled-static-init-invalid-await.src.js @@ -0,0 +1,25 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: Restriction on `await` +info: | + LabelIdentifier : Identifier + + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + await: 0; + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-invalid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-invalid.result.js new file mode 100644 index 00000000..ec150686 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-invalid.result.js @@ -0,0 +1,6 @@ +export default { + "index": 713, + "lineNumber": 24, + "column": 9, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-invalid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-invalid.src.js new file mode 100644 index 00000000..0bff5e18 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-invalid.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: BindingIdentifier may not be `await` within class static blocks +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + let await; + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.module-result.js new file mode 100644 index 00000000..dad0ac95 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 528, + "lineNumber": 16, + "column": 18, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.result.js new file mode 100644 index 00000000..5796e5c8 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.result.js @@ -0,0 +1,534 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 544 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 544 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 544 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 502, + 542 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 515, + 538 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 516, + 536 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 522, + 536 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 524, + 534 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 528, + 533 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 528, + 533 + ], + "name": "await" + }, + "init": null + } + ], + "kind": "let" + } + ] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 490, + 495 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 502, + 508 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 509, + 510 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 515, + 516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 519, + 521 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "range": [ + 524, + 527 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 528, + 533 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 533, + 534 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 535, + 536 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "range": [ + 536, + 537 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 537, + 538 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 541, + 542 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 543, + 544 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.src.js new file mode 100644 index 00000000..95789d62 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-let-static-init-await-binding-valid.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within arrow function bodies +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => { let await; }); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-invalid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-invalid.result.js new file mode 100644 index 00000000..b2a11a0c --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-invalid.result.js @@ -0,0 +1,6 @@ +export default { + "index": 723, + "lineNumber": 24, + "column": 19, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-invalid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-invalid.src.js new file mode 100644 index 00000000..32faff64 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-invalid.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: BindingIdentifier may not be `await` within class static blocks +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + try {} catch (await) {} + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.module-result.js new file mode 100644 index 00000000..d56e73ce --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 538, + "lineNumber": 16, + "column": 28, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.result.js new file mode 100644 index 00000000..202840d9 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.result.js @@ -0,0 +1,675 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 557 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 557 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 557 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 502, + 555 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 40 + } + }, + "range": [ + 515, + 551 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 38 + } + }, + "range": [ + 516, + 549 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 38 + } + }, + "range": [ + 522, + 549 + ], + "body": [ + { + "type": "TryStatement", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 36 + } + }, + "range": [ + 524, + 547 + ], + "block": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 528, + 530 + ], + "body": [] + }, + "handler": { + "type": "CatchClause", + "loc": { + "start": { + "line": 16, + "column": 20 + }, + "end": { + "line": 16, + "column": 36 + } + }, + "range": [ + 531, + 547 + ], + "param": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 538, + 543 + ], + "name": "await" + }, + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 34 + }, + "end": { + "line": 16, + "column": 36 + } + }, + "range": [ + 545, + 547 + ], + "body": [] + } + }, + "finalizer": null + } + ] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 490, + 495 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 502, + 508 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 509, + 510 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 515, + 516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 519, + 521 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Keyword", + "value": "try", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "range": [ + 524, + 527 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 528, + 529 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "range": [ + 529, + 530 + ] + }, + { + "type": "Keyword", + "value": "catch", + "loc": { + "start": { + "line": 16, + "column": 20 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 531, + 536 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 537, + 538 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 538, + 543 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 32 + }, + "end": { + "line": 16, + "column": 33 + } + }, + "range": [ + 543, + 544 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 34 + }, + "end": { + "line": 16, + "column": 35 + } + }, + "range": [ + 545, + 546 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 35 + }, + "end": { + "line": 16, + "column": 36 + } + }, + "range": [ + 546, + 547 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 37 + }, + "end": { + "line": 16, + "column": 38 + } + }, + "range": [ + 548, + 549 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 38 + }, + "end": { + "line": 16, + "column": 39 + } + }, + "range": [ + 549, + 550 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 39 + }, + "end": { + "line": 16, + "column": 40 + } + }, + "range": [ + 550, + 551 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 554, + 555 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 556, + 557 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.src.js new file mode 100644 index 00000000..e72b12d1 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-try-static-init-await-binding-valid.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within arrow function bodies +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => { try {} catch (await) {} }); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-invalid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-invalid.result.js new file mode 100644 index 00000000..0a6e708b --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-invalid.result.js @@ -0,0 +1,6 @@ +export default { + "index": 714, + "lineNumber": 24, + "column": 10, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-invalid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-invalid.src.js new file mode 100644 index 00000000..68573272 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-invalid.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: BindingIdentifier may not be `await` within class static blocks +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + var [await] = []; + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.module-result.js new file mode 100644 index 00000000..6cd74794 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 529, + "lineNumber": 16, + "column": 19, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.result.js new file mode 100644 index 00000000..8b7e8309 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.result.js @@ -0,0 +1,660 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 551 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 551 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 551 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 502, + 549 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 34 + } + }, + "range": [ + 515, + 545 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 516, + 543 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 522, + 543 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 30 + } + }, + "range": [ + 524, + 541 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 528, + 540 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 528, + 535 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 529, + 534 + ], + "name": "await" + } + ] + }, + "init": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 538, + 540 + ], + "elements": [] + } + } + ], + "kind": "var" + } + ] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 490, + 495 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 502, + 508 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 509, + 510 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 515, + 516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 519, + 521 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "range": [ + 524, + 527 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 528, + 529 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 529, + 534 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 534, + 535 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "range": [ + 536, + 537 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 538, + 539 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 539, + 540 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 30 + } + }, + "range": [ + 540, + 541 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 32 + }, + "end": { + "line": 16, + "column": 33 + } + }, + "range": [ + 543, + 544 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 33 + }, + "end": { + "line": 16, + "column": 34 + } + }, + "range": [ + 544, + 545 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 548, + 549 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 550, + 551 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.src.js new file mode 100644 index 00000000..d6f2c5d9 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-ary-ptrn-elem-id-static-init-await-valid.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within arrow function bodies +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => { var [await] = []; }); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-invalid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-invalid.result.js new file mode 100644 index 00000000..0a6e708b --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-invalid.result.js @@ -0,0 +1,6 @@ +export default { + "index": 714, + "lineNumber": 24, + "column": 10, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-invalid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-invalid.src.js new file mode 100644 index 00000000..377791ab --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-invalid.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: BindingIdentifier may not be `await` within class static blocks +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + var {await} = {}; + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.module-result.js new file mode 100644 index 00000000..6cd74794 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 529, + "lineNumber": 16, + "column": 19, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.result.js new file mode 100644 index 00000000..2a6893bd --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.result.js @@ -0,0 +1,699 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 551 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 551 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 551 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 502, + 549 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 34 + } + }, + "range": [ + 515, + 545 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 516, + 543 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 522, + 543 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 30 + } + }, + "range": [ + 524, + 541 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 528, + 540 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 528, + 535 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 529, + 534 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 529, + 534 + ], + "name": "await" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 529, + 534 + ], + "name": "await" + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 538, + 540 + ], + "properties": [] + } + } + ], + "kind": "var" + } + ] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 490, + 495 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 502, + 508 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 509, + 510 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 515, + 516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 519, + 521 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "range": [ + 524, + 527 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "range": [ + 528, + 529 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 529, + 534 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "range": [ + 534, + 535 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "range": [ + 536, + 537 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "range": [ + 538, + 539 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 29 + } + }, + "range": [ + 539, + 540 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 30 + } + }, + "range": [ + 540, + 541 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 32 + } + }, + "range": [ + 542, + 543 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 32 + }, + "end": { + "line": 16, + "column": 33 + } + }, + "range": [ + 543, + 544 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 33 + }, + "end": { + "line": 16, + "column": 34 + } + }, + "range": [ + 544, + 545 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 548, + 549 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 550, + 551 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.src.js new file mode 100644 index 00000000..f71e0567 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-dstr-obj-ptrn-elem-id-static-init-await-valid.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within arrow function bodies +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => { var {await} = {}; }); + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-invalid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-invalid.result.js new file mode 100644 index 00000000..ec150686 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-invalid.result.js @@ -0,0 +1,6 @@ +export default { + "index": 713, + "lineNumber": 24, + "column": 9, + "message": "Cannot use await in class static initialization block" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-invalid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-invalid.src.js new file mode 100644 index 00000000..b6319b00 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-invalid.src.js @@ -0,0 +1,26 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: BindingIdentifier may not be `await` within class static blocks +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + var await; + } +} diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.module-result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.module-result.js new file mode 100644 index 00000000..dad0ac95 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 528, + "lineNumber": 16, + "column": 18, + "message": "Cannot use keyword 'await' outside an async function" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.result.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.result.js new file mode 100644 index 00000000..8090c27b --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.result.js @@ -0,0 +1,534 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 544 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 490, + 544 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ], + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 498, + 544 + ], + "body": [ + { + "type": "StaticBlock", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 502, + 542 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 515, + 538 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 516, + 536 + ], + "id": null, + "expression": false, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 522, + 536 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 524, + 534 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 528, + 533 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 528, + 533 + ], + "name": "await" + }, + "init": null + } + ], + "kind": "var" + } + ] + } + } + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + }, + "range": [ + 490, + 495 + ] + }, + { + "type": "Identifier", + "value": "C", + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + }, + "range": [ + 496, + 497 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + }, + "range": [ + 498, + 499 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + }, + "range": [ + 502, + 508 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 10 + } + }, + "range": [ + 509, + 510 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 16, + "column": 5 + } + }, + "range": [ + 515, + 516 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 16, + "column": 5 + }, + "end": { + "line": 16, + "column": 6 + } + }, + "range": [ + 516, + 517 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 6 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "range": [ + 517, + 518 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 10 + } + }, + "range": [ + 519, + 521 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + }, + "range": [ + 522, + 523 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "range": [ + 524, + 527 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 22 + } + }, + "range": [ + 528, + 533 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 23 + } + }, + "range": [ + 533, + 534 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "range": [ + 535, + 536 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "range": [ + 536, + 537 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "range": [ + 537, + 538 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 3 + } + }, + "range": [ + 541, + 542 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "range": [ + 543, + 544 + ] + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.src.js b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.src.js new file mode 100644 index 00000000..eef43047 --- /dev/null +++ b/tests/fixtures/ecma-version/13/class-static-blocks/statements-variable-static-init-await-binding-valid.src.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within arrow function bodies +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => { var await; }); + } +}