From 3703d2bad19aa029130c237044f20d53b921351b Mon Sep 17 00:00:00 2001 From: Leo Balter <leonardo.balter@gmail.com> Date: Fri, 30 Nov 2018 18:35:01 -0500 Subject: [PATCH] Generate tests --- ...ield-init-call-expression-bad-reference.js | 52 +++++++++++++++++ .../field-init-call-expression-this.js | 52 +++++++++++++++++ ...d-init-fn-call-expression-bad-reference.js | 52 +++++++++++++++++ .../field-init-fn-call-expression-this.js | 52 +++++++++++++++++ ...init-fn-member-expression-bad-reference.js | 52 +++++++++++++++++ .../field-init-fn-member-expression-this.js | 52 +++++++++++++++++ ...-heritage-call-expression-bad-reference.js | 56 ++++++++++++++++++ ...ield-init-heritage-call-expression-this.js | 56 ++++++++++++++++++ ...eritage-member-expression-bad-reference.js | 56 ++++++++++++++++++ ...ld-init-heritage-member-expression-this.js | 56 ++++++++++++++++++ ...ld-init-member-expression-bad-reference.js | 52 +++++++++++++++++ .../field-init-member-expression-this.js | 52 +++++++++++++++++ .../method-call-expression-bad-reference.js | 52 +++++++++++++++++ .../method-call-expression-this.js | 52 +++++++++++++++++ ...method-fn-call-expression-bad-reference.js | 54 +++++++++++++++++ .../method-fn-call-expression-this.js | 54 +++++++++++++++++ ...thod-fn-member-expression-bad-reference.js | 54 +++++++++++++++++ .../method-fn-member-expression-this.js | 54 +++++++++++++++++ ...-heritage-call-expression-bad-reference.js | 58 +++++++++++++++++++ .../method-heritage-call-expression-this.js | 58 +++++++++++++++++++ ...eritage-member-expression-bad-reference.js | 58 +++++++++++++++++++ .../method-heritage-member-expression-this.js | 58 +++++++++++++++++++ ...hod-inner-call-expression-bad-reference.js | 57 ++++++++++++++++++ .../method-inner-call-expression-this.js | 57 ++++++++++++++++++ ...d-inner-member-expression-bad-reference.js | 57 ++++++++++++++++++ .../method-inner-member-expression-this.js | 57 ++++++++++++++++++ .../method-member-expression-bad-reference.js | 52 +++++++++++++++++ .../method-member-expression-this.js | 52 +++++++++++++++++ ...od-outter-call-expression-bad-reference.js | 58 +++++++++++++++++++ .../method-outter-call-expression-this.js | 58 +++++++++++++++++++ ...-outter-member-expression-bad-reference.js | 58 +++++++++++++++++++ .../method-outter-member-expression-this.js | 58 +++++++++++++++++++ ...lid-names-call-expression-bad-reference.js | 40 +++++++++++++ .../invalid-names-call-expression-this.js | 40 +++++++++++++ ...d-names-member-expression-bad-reference.js | 40 +++++++++++++ .../invalid-names-member-expression-this.js | 40 +++++++++++++ ...ate-names-call-expression-bad-reference.js | 40 +++++++++++++ ...alid-private-names-call-expression-this.js | 40 +++++++++++++ ...e-names-member-expression-bad-reference.js | 40 +++++++++++++ ...id-private-names-member-expression-this.js | 40 +++++++++++++ ...ate-names-call-expression-bad-reference.js | 40 +++++++++++++ ...alid-private-names-call-expression-this.js | 40 +++++++++++++ ...e-names-member-expression-bad-reference.js | 40 +++++++++++++ ...id-private-names-member-expression-this.js | 40 +++++++++++++ ...lid-names-call-expression-bad-reference.js | 40 +++++++++++++ .../invalid-names-call-expression-this.js | 40 +++++++++++++ ...d-names-member-expression-bad-reference.js | 40 +++++++++++++ .../invalid-names-member-expression-this.js | 40 +++++++++++++ ...ield-init-call-expression-bad-reference.js | 42 ++++++++++++++ .../field-init-call-expression-this.js | 42 ++++++++++++++ ...d-init-fn-call-expression-bad-reference.js | 42 ++++++++++++++ .../field-init-fn-call-expression-this.js | 42 ++++++++++++++ ...init-fn-member-expression-bad-reference.js | 42 ++++++++++++++ .../field-init-fn-member-expression-this.js | 42 ++++++++++++++ ...ld-init-member-expression-bad-reference.js | 42 ++++++++++++++ .../field-init-member-expression-this.js | 42 ++++++++++++++ ...-heritage-call-expression-bad-reference.js | 57 ++++++++++++++++++ ...elds-init-heritage-call-expression-this.js | 57 ++++++++++++++++++ ...eritage-member-expression-bad-reference.js | 57 ++++++++++++++++++ ...ds-init-heritage-member-expression-this.js | 57 ++++++++++++++++++ .../method-call-expression-bad-reference.js | 42 ++++++++++++++ .../method-call-expression-this.js | 42 ++++++++++++++ ...method-fn-call-expression-bad-reference.js | 44 ++++++++++++++ .../method-fn-call-expression-this.js | 44 ++++++++++++++ ...thod-fn-member-expression-bad-reference.js | 44 ++++++++++++++ .../method-fn-member-expression-this.js | 44 ++++++++++++++ ...-heritage-call-expression-bad-reference.js | 58 +++++++++++++++++++ .../method-heritage-call-expression-this.js | 58 +++++++++++++++++++ ...eritage-member-expression-bad-reference.js | 58 +++++++++++++++++++ .../method-heritage-member-expression-this.js | 58 +++++++++++++++++++ ...hod-inner-call-expression-bad-reference.js | 57 ++++++++++++++++++ .../method-inner-call-expression-this.js | 57 ++++++++++++++++++ ...d-inner-member-expression-bad-reference.js | 57 ++++++++++++++++++ .../method-inner-member-expression-this.js | 57 ++++++++++++++++++ .../method-member-expression-bad-reference.js | 42 ++++++++++++++ .../method-member-expression-this.js | 42 ++++++++++++++ ...od-outter-call-expression-bad-reference.js | 58 +++++++++++++++++++ .../method-outter-call-expression-this.js | 58 +++++++++++++++++++ ...-outter-member-expression-bad-reference.js | 58 +++++++++++++++++++ .../method-outter-member-expression-this.js | 58 +++++++++++++++++++ ...lid-names-call-expression-bad-reference.js | 40 +++++++++++++ .../invalid-names-call-expression-this.js | 40 +++++++++++++ ...d-names-member-expression-bad-reference.js | 40 +++++++++++++ .../invalid-names-member-expression-this.js | 40 +++++++++++++ 84 files changed, 4156 insertions(+) create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-call-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-call-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-call-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-member-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-member-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/field-init-member-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-call-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-call-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-member-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-call-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-member-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-member-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-call-expression-this.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js create mode 100644 test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-member-expression-this.js create mode 100644 test/language/expressions/function/early-errors/invalid-names-call-expression-bad-reference.js create mode 100644 test/language/expressions/function/early-errors/invalid-names-call-expression-this.js create mode 100644 test/language/expressions/function/early-errors/invalid-names-member-expression-bad-reference.js create mode 100644 test/language/expressions/function/early-errors/invalid-names-member-expression-this.js create mode 100644 test/language/global-code/invalid-private-names-call-expression-bad-reference.js create mode 100644 test/language/global-code/invalid-private-names-call-expression-this.js create mode 100644 test/language/global-code/invalid-private-names-member-expression-bad-reference.js create mode 100644 test/language/global-code/invalid-private-names-member-expression-this.js create mode 100644 test/language/module-code/invalid-private-names-call-expression-bad-reference.js create mode 100644 test/language/module-code/invalid-private-names-call-expression-this.js create mode 100644 test/language/module-code/invalid-private-names-member-expression-bad-reference.js create mode 100644 test/language/module-code/invalid-private-names-member-expression-this.js create mode 100644 test/language/statements/block/early-errors/invalid-names-call-expression-bad-reference.js create mode 100644 test/language/statements/block/early-errors/invalid-names-call-expression-this.js create mode 100644 test/language/statements/block/early-errors/invalid-names-member-expression-bad-reference.js create mode 100644 test/language/statements/block/early-errors/invalid-names-member-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/field-init-call-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/field-init-member-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-call-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-fn-call-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-fn-member-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-inner-call-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-inner-member-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-member-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-outter-call-expression-this.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js create mode 100644 test/language/statements/class/syntax/early-errors/invalid-names/method-outter-member-expression-this.js create mode 100644 test/language/statements/function/early-errors/invalid-names-call-expression-bad-reference.js create mode 100644 test/language/statements/function/early-errors/invalid-names-call-expression-this.js create mode 100644 test/language/statements/function/early-errors/invalid-names-member-expression-bad-reference.js create mode 100644 test/language/statements/function/early-errors/invalid-names-member-expression-this.js diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js new file mode 100644 index 0000000000..11be1d59ee --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = (() => {})().#x +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-call-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-call-expression-this.js new file mode 100644 index 0000000000..e412b99920 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-call-expression-this.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = (() => this)().#x +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js new file mode 100644 index 0000000000..354b27ddca --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer-fn.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, function in class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = function() { (() => {})().#x } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js new file mode 100644 index 0000000000..6741392a60 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer-fn.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, function in class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = function() { (() => this)().#x } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js new file mode 100644 index 0000000000..140c8805b0 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer-fn.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, function in class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = function() { something.#x } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js new file mode 100644 index 0000000000..9eb1000944 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer-fn.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, function in class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = function() { this.#x } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-call-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-call-expression-bad-reference.js new file mode 100644 index 0000000000..3812ab0e95 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-call-expression-bad-reference.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer-heritage.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, field initializer in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + f = (() => {})().#x +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-call-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-call-expression-this.js new file mode 100644 index 0000000000..f1386b079f --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-call-expression-this.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer-heritage.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, field initializer in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + f = (() => this)().#x +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-member-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-member-expression-bad-reference.js new file mode 100644 index 0000000000..27a6dacec4 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-member-expression-bad-reference.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer-heritage.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, field initializer in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + f = something.#x +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-member-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-member-expression-this.js new file mode 100644 index 0000000000..9eb4ee3b47 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-heritage-member-expression-this.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer-heritage.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, field initializer in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + f = this.#x +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js new file mode 100644 index 0000000000..da219eccd1 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-field-initializer.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = something.#x +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-member-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-member-expression-this.js new file mode 100644 index 0000000000..66cca83e2c --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/field-init-member-expression-this.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-field-initializer.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + f = this.#x +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js new file mode 100644 index 0000000000..d4e0e58203 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { (() => {})().#x } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-call-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-call-expression-this.js new file mode 100644 index 0000000000..3686d2abd5 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-call-expression-this.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-method.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { (() => this)().#x } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js new file mode 100644 index 0000000000..7833668c89 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method-fn.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, inner function in method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + function fn() { (() => {})().#x } + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-call-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-call-expression-this.js new file mode 100644 index 0000000000..7168b6ab96 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-call-expression-this.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-method-fn.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, inner function in method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + function fn() { (() => this)().#x } + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js new file mode 100644 index 0000000000..86e68c10ac --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method-fn.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, inner function in method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + function fn() { something.#x } + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-member-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-member-expression-this.js new file mode 100644 index 0000000000..93b9770051 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-fn-member-expression-this.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-method-fn.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, inner function in method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + function fn() { this.#x } + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js new file mode 100644 index 0000000000..823bed9f68 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method-heritage.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + m() { + (() => {})().#x + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js new file mode 100644 index 0000000000..c4f35c61ad --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-method-heritage.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + m() { + (() => this)().#x + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js new file mode 100644 index 0000000000..b010cf3ec6 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method-heritage.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + m() { + something.#x + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js new file mode 100644 index 0000000000..6383a205f2 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-method-heritage.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +var C = class extends Parent { + m() { + this.#x + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference.js new file mode 100644 index 0000000000..eaa9f0a47a --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-inner-method.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = 42; + m() { + class Inner { + z() { (() => {})().#x } + } + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-call-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-call-expression-this.js new file mode 100644 index 0000000000..75e392e56d --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-call-expression-this.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-inner-method.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = 42; + m() { + class Inner { + z() { (() => this)().#x } + } + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference.js new file mode 100644 index 0000000000..5d6af39f83 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-inner-method.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = 42; + m() { + class Inner { + z() { something.#x } + } + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-member-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-member-expression-this.js new file mode 100644 index 0000000000..22734ed775 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-inner-member-expression-this.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-inner-method.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in inner class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + #x = 42; + m() { + class Inner { + z() { this.#x } + } + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js new file mode 100644 index 0000000000..74aeab12d8 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-method.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { something.#x } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-member-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-member-expression-this.js new file mode 100644 index 0000000000..e21e1b640e --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-member-expression-this.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-method.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { this.#x } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js new file mode 100644 index 0000000000..7841fdec3f --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-outter-method.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in outter class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-call-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-call-expression-this.js new file mode 100644 index 0000000000..b27fef5cdf --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-call-expression-this.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-expr-outter-method.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in outter class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js new file mode 100644 index 0000000000..d2338248e4 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-expr-outter-method.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in outter class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +}; diff --git a/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-member-expression-this.js b/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-member-expression-this.js new file mode 100644 index 0000000000..789225a68d --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/invalid-names/method-outter-member-expression-this.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-expr-outter-method.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in outter class expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var C = class { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +}; diff --git a/test/language/expressions/function/early-errors/invalid-names-call-expression-bad-reference.js b/test/language/expressions/function/early-errors/invalid-names-call-expression-bad-reference.js new file mode 100644 index 0000000000..7e9fbc6daf --- /dev/null +++ b/test/language/expressions/function/early-errors/invalid-names-call-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/function-expr.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, inside function expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var fn = function() { (() => {})().#x }; diff --git a/test/language/expressions/function/early-errors/invalid-names-call-expression-this.js b/test/language/expressions/function/early-errors/invalid-names-call-expression-this.js new file mode 100644 index 0000000000..bffe459c2c --- /dev/null +++ b/test/language/expressions/function/early-errors/invalid-names-call-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/function-expr.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, inside function expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var fn = function() { (() => this)().#x }; diff --git a/test/language/expressions/function/early-errors/invalid-names-member-expression-bad-reference.js b/test/language/expressions/function/early-errors/invalid-names-member-expression-bad-reference.js new file mode 100644 index 0000000000..9221b41148 --- /dev/null +++ b/test/language/expressions/function/early-errors/invalid-names-member-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/function-expr.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, inside function expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var fn = function() { something.#x }; diff --git a/test/language/expressions/function/early-errors/invalid-names-member-expression-this.js b/test/language/expressions/function/early-errors/invalid-names-member-expression-this.js new file mode 100644 index 0000000000..4485da5352 --- /dev/null +++ b/test/language/expressions/function/early-errors/invalid-names-member-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/function-expr.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, inside function expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +var fn = function() { this.#x }; diff --git a/test/language/global-code/invalid-private-names-call-expression-bad-reference.js b/test/language/global-code/invalid-private-names-call-expression-bad-reference.js new file mode 100644 index 0000000000..b116eb500e --- /dev/null +++ b/test/language/global-code/invalid-private-names-call-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/top-level-scriptbody.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, top level of script body) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +(() => {})().#x diff --git a/test/language/global-code/invalid-private-names-call-expression-this.js b/test/language/global-code/invalid-private-names-call-expression-this.js new file mode 100644 index 0000000000..238934669a --- /dev/null +++ b/test/language/global-code/invalid-private-names-call-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/top-level-scriptbody.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, top level of script body) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +(() => this)().#x diff --git a/test/language/global-code/invalid-private-names-member-expression-bad-reference.js b/test/language/global-code/invalid-private-names-member-expression-bad-reference.js new file mode 100644 index 0000000000..e1ce1cb04f --- /dev/null +++ b/test/language/global-code/invalid-private-names-member-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/top-level-scriptbody.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, top level of script body) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +something.#x diff --git a/test/language/global-code/invalid-private-names-member-expression-this.js b/test/language/global-code/invalid-private-names-member-expression-this.js new file mode 100644 index 0000000000..8fd333f28a --- /dev/null +++ b/test/language/global-code/invalid-private-names-member-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/top-level-scriptbody.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, top level of script body) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +this.#x diff --git a/test/language/module-code/invalid-private-names-call-expression-bad-reference.js b/test/language/module-code/invalid-private-names-call-expression-bad-reference.js new file mode 100644 index 0000000000..51261e3493 --- /dev/null +++ b/test/language/module-code/invalid-private-names-call-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/top-level-modulebody.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, top level of module body) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +(() => {})().#x diff --git a/test/language/module-code/invalid-private-names-call-expression-this.js b/test/language/module-code/invalid-private-names-call-expression-this.js new file mode 100644 index 0000000000..2ea37e1a6a --- /dev/null +++ b/test/language/module-code/invalid-private-names-call-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/top-level-modulebody.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, top level of module body) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +(() => this)().#x diff --git a/test/language/module-code/invalid-private-names-member-expression-bad-reference.js b/test/language/module-code/invalid-private-names-member-expression-bad-reference.js new file mode 100644 index 0000000000..698bee0b34 --- /dev/null +++ b/test/language/module-code/invalid-private-names-member-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/top-level-modulebody.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, top level of module body) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +something.#x diff --git a/test/language/module-code/invalid-private-names-member-expression-this.js b/test/language/module-code/invalid-private-names-member-expression-this.js new file mode 100644 index 0000000000..671d5eb39e --- /dev/null +++ b/test/language/module-code/invalid-private-names-member-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/top-level-modulebody.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, top level of module body) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +this.#x diff --git a/test/language/statements/block/early-errors/invalid-names-call-expression-bad-reference.js b/test/language/statements/block/early-errors/invalid-names-call-expression-bad-reference.js new file mode 100644 index 0000000000..7c13a22f7b --- /dev/null +++ b/test/language/statements/block/early-errors/invalid-names-call-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/block.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, block statement) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +{ (() => {})().#x } diff --git a/test/language/statements/block/early-errors/invalid-names-call-expression-this.js b/test/language/statements/block/early-errors/invalid-names-call-expression-this.js new file mode 100644 index 0000000000..94eb16a6ed --- /dev/null +++ b/test/language/statements/block/early-errors/invalid-names-call-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/block.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, block statement) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +{ (() => this)().#x } diff --git a/test/language/statements/block/early-errors/invalid-names-member-expression-bad-reference.js b/test/language/statements/block/early-errors/invalid-names-member-expression-bad-reference.js new file mode 100644 index 0000000000..4d0e6a026a --- /dev/null +++ b/test/language/statements/block/early-errors/invalid-names-member-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/block.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, block statement) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +{ something.#x } diff --git a/test/language/statements/block/early-errors/invalid-names-member-expression-this.js b/test/language/statements/block/early-errors/invalid-names-member-expression-this.js new file mode 100644 index 0000000000..43b10f0872 --- /dev/null +++ b/test/language/statements/block/early-errors/invalid-names-member-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/block.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, block statement) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +{ this.#x } diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js new file mode 100644 index 0000000000..618e273934 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-field-initializer.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + f = (() => {})().#x +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/field-init-call-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-call-expression-this.js new file mode 100644 index 0000000000..0078c8945a --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-call-expression-this.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-decl-field-initializer.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + f = (() => this)().#x +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js new file mode 100644 index 0000000000..8cb93bf509 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-field-initializer-fn.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, function in class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + f = function() { (() => {})().#x } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js new file mode 100644 index 0000000000..b549163ba8 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-decl-field-initializer-fn.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, function in class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + f = function() { (() => this)().#x } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js new file mode 100644 index 0000000000..cb9b644b98 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-field-initializer-fn.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, function in class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + f = function() { something.#x } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js new file mode 100644 index 0000000000..8c001b59e2 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-decl-field-initializer-fn.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, function in class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + f = function() { this.#x } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js new file mode 100644 index 0000000000..db9d868122 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-field-initializer.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + f = something.#x +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/field-init-member-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-member-expression-this.js new file mode 100644 index 0000000000..88329f3ca7 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/field-init-member-expression-this.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-decl-field-initializer.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + f = this.#x +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js new file mode 100644 index 0000000000..2c9d9382cf --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-field-initializer-heritage.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +class C extends Parent { + f = (() => {})().#x +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js new file mode 100644 index 0000000000..d26f4ea09b --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-decl-field-initializer-heritage.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +class C extends Parent { + f = (() => this)().#x +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js new file mode 100644 index 0000000000..e166c1e338 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-field-initializer-heritage.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +class C extends Parent { + f = something.#x +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js new file mode 100644 index 0000000000..7a4205213d --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-decl-field-initializer-heritage.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +class C extends Parent { + f = this.#x +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js new file mode 100644 index 0000000000..4177df7a08 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-method.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { (() => {})().#x } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-call-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-call-expression-this.js new file mode 100644 index 0000000000..62ee9b59bc --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-call-expression-this.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-decl-method.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { (() => this)().#x } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js new file mode 100644 index 0000000000..58f19bd49c --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-method-fn.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, inner function in method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { + function fn() { (() => {})().#x } + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-call-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-call-expression-this.js new file mode 100644 index 0000000000..1371cb652e --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-call-expression-this.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-decl-method-fn.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, inner function in method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { + function fn() { (() => this)().#x } + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js new file mode 100644 index 0000000000..754348b0d4 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-method-fn.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, inner function in method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { + function fn() { something.#x } + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-member-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-member-expression-this.js new file mode 100644 index 0000000000..247c045167 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-fn-member-expression-this.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-decl-method-fn.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, inner function in method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { + function fn() { this.#x } + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js new file mode 100644 index 0000000000..6d6c6b174c --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-method-heritage.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +class C extends Parent { + m() { + (() => {})().#x + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js new file mode 100644 index 0000000000..505e813312 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-decl-method-heritage.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +class C extends Parent { + m() { + (() => this)().#x + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js new file mode 100644 index 0000000000..da3dbf6858 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-method-heritage.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +class C extends Parent { + m() { + something.#x + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js new file mode 100644 index 0000000000..4a43adaab5 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-decl-method-heritage.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class Parent { + #x = 42; +} + +class C extends Parent { + m() { + this.#x + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference.js new file mode 100644 index 0000000000..8f8277bb1b --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-inner-method.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in inner class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + #x = 42; + m() { + class Inner { + z() { (() => {})().#x } + } + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-call-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-call-expression-this.js new file mode 100644 index 0000000000..f97faa1c65 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-call-expression-this.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-decl-inner-method.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in inner class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + #x = 42; + m() { + class Inner { + z() { (() => this)().#x } + } + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference.js new file mode 100644 index 0000000000..58db4909b1 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-inner-method.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in inner class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + #x = 42; + m() { + class Inner { + z() { something.#x } + } + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-member-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-member-expression-this.js new file mode 100644 index 0000000000..820cc19245 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-inner-member-expression-this.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-decl-inner-method.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in inner class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + #x = 42; + m() { + class Inner { + z() { this.#x } + } + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js new file mode 100644 index 0000000000..0644a6b916 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-method.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { something.#x } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-member-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-member-expression-this.js new file mode 100644 index 0000000000..3df8bf253d --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-member-expression-this.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-decl-method.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { this.#x } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js new file mode 100644 index 0000000000..84a701adbf --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-outter-method.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in outter class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-call-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-call-expression-this.js new file mode 100644 index 0000000000..e2b94d4c6c --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-call-expression-this.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/cls-decl-outter-method.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in outter class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js new file mode 100644 index 0000000000..8eb78f6165 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/cls-decl-outter-method.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in outter class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +} diff --git a/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-member-expression-this.js b/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-member-expression-this.js new file mode 100644 index 0000000000..f431232625 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/invalid-names/method-outter-member-expression-this.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/cls-decl-outter-method.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, method in outter class declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + Static Semantics: AllPrivateNamesValid + + ClassBody : ClassElementList + 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody. + 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames. + + For all other grammatical productions, recurse on subexpressions/substatements, + passing in the names of the caller. If all pieces return true, then return true. + If any returns false, return false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +class C { + m() { + class Outter { + #x = 42; + } + + this.#x; + } +} diff --git a/test/language/statements/function/early-errors/invalid-names-call-expression-bad-reference.js b/test/language/statements/function/early-errors/invalid-names-call-expression-bad-reference.js new file mode 100644 index 0000000000..bca7a58050 --- /dev/null +++ b/test/language/statements/function/early-errors/invalid-names-call-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/function-decl.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, inside function declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +function fn() { (() => {})().#x } diff --git a/test/language/statements/function/early-errors/invalid-names-call-expression-this.js b/test/language/statements/function/early-errors/invalid-names-call-expression-this.js new file mode 100644 index 0000000000..732fba2e74 --- /dev/null +++ b/test/language/statements/function/early-errors/invalid-names-call-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/function-decl.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, inside function declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +function fn() { (() => this)().#x } diff --git a/test/language/statements/function/early-errors/invalid-names-member-expression-bad-reference.js b/test/language/statements/function/early-errors/invalid-names-member-expression-bad-reference.js new file mode 100644 index 0000000000..d01110a7a9 --- /dev/null +++ b/test/language/statements/function/early-errors/invalid-names-member-expression-bad-reference.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/function-decl.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, inside function declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +function fn() { something.#x } diff --git a/test/language/statements/function/early-errors/invalid-names-member-expression-this.js b/test/language/statements/function/early-errors/invalid-names-member-expression-this.js new file mode 100644 index 0000000000..f861b471c5 --- /dev/null +++ b/test/language/statements/function/early-errors/invalid-names-member-expression-this.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/function-decl.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, inside function declaration) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ScriptBody:StatementList + It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List + as an argument is false unless the source code is eval code that is being + processed by a direct eval. + + ModuleBody:ModuleItemList + It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List + as an argument is false. + + + Static Semantics: AllPrivateNamesValid + + MemberExpression : MemberExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + + CallExpression : CallExpression . PrivateName + + 1. If StringValue of PrivateName is in names, return true. + 2. Return false. + +---*/ + + +$DONOTEVALUATE(); + +function fn() { this.#x } -- GitLab