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 0000000000000000000000000000000000000000..11be1d59ee4e42c15f66933ae1101fb2139a141f --- /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 0000000000000000000000000000000000000000..e412b999206797fb16e220ef41513ef6edf23ba5 --- /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 0000000000000000000000000000000000000000..354b27ddca5763cbe3016893c6d4dd3922e0d562 --- /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 0000000000000000000000000000000000000000..6741392a60679d3523cb3de0d0994649d5948387 --- /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 0000000000000000000000000000000000000000..140c8805b042db0bfd4ba9505111288bb190da6d --- /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 0000000000000000000000000000000000000000..9eb10009440b9b6ba27bff44761b0a411488a4d8 --- /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 0000000000000000000000000000000000000000..3812ab0e957cf64255afe9e60ee000e6c9057edc --- /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 0000000000000000000000000000000000000000..f1386b079f5b43312a87c6cfc836a44b4d3484ca --- /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 0000000000000000000000000000000000000000..27a6dacec42bc6868c068003da9c4ba07e2e8f7b --- /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 0000000000000000000000000000000000000000..9eb4ee3b47108f278fbbc70861d069b1f0fadc25 --- /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 0000000000000000000000000000000000000000..da219eccd1e55193136b4342c1062b1d43b7f31b --- /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 0000000000000000000000000000000000000000..66cca83e2cf7fb5847b116b6fa74542d401ea84b --- /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 0000000000000000000000000000000000000000..d4e0e58203672dd9aacab65923145ef9b5ed636c --- /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 0000000000000000000000000000000000000000..3686d2abd5558990d2fc185665e0dce8e4da2d58 --- /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 0000000000000000000000000000000000000000..7833668c891e9929e2def428cd752dcda22a60a2 --- /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 0000000000000000000000000000000000000000..7168b6ab969565ec92e964b5b0cc370814014be1 --- /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 0000000000000000000000000000000000000000..86e68c10ac6fec5a501990bc44c5c0dea13e2387 --- /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 0000000000000000000000000000000000000000..93b9770051249f4f2ac9aef2ce413249b4ba0424 --- /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 0000000000000000000000000000000000000000..823bed9f684d6ad47547c8900ce5d2b9a63df6f8 --- /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 0000000000000000000000000000000000000000..c4f35c61adf8b7219073a603e5aadc95654669ff --- /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 0000000000000000000000000000000000000000..b010cf3ec61779e008c891a87a18978ec684fc80 --- /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 0000000000000000000000000000000000000000..6383a205f20a037f823b491bc64ebb4b7bd238a0 --- /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 0000000000000000000000000000000000000000..eaa9f0a47aa74fd7ef99c253110302c4bbfbff2e --- /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 0000000000000000000000000000000000000000..75e392e56dae691dd00f7a54e9e4e175b113365b --- /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 0000000000000000000000000000000000000000..5d6af39f8348a261ecd1bfee1527114a6d048557 --- /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 0000000000000000000000000000000000000000..22734ed7754ce3091d3e2fc2fc5d4b43d3f21fcb --- /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 0000000000000000000000000000000000000000..74aeab12d8e006ff54b1e4191993899a9644e82f --- /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 0000000000000000000000000000000000000000..e21e1b640e374e40042fcff01145adca491a2884 --- /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 0000000000000000000000000000000000000000..7841fdec3f28f9c79d720fca906ba03b74a74707 --- /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 0000000000000000000000000000000000000000..b27fef5cdfd3ac85a47785846012ab42a5268d99 --- /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 0000000000000000000000000000000000000000..d2338248e47ba40e37bc804872eb7b15228575be --- /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 0000000000000000000000000000000000000000..789225a68dc9c8f515551ea7f62baf3c393e30cd --- /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 0000000000000000000000000000000000000000..7e9fbc6daf145a6a70a21e4c0c25a1c29bf56ec5 --- /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 0000000000000000000000000000000000000000..bffe459c2cf06aa3a8c7e0ca6bd0338ed79bda62 --- /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 0000000000000000000000000000000000000000..9221b411480055e21507c0791c959afb2cc3e902 --- /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 0000000000000000000000000000000000000000..4485da53529d919cc758bba34912f0fb9490ca53 --- /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 0000000000000000000000000000000000000000..b116eb500ee2db75f07a3325714bdce3616e6ce6 --- /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 0000000000000000000000000000000000000000..238934669a8ca0d554df16fd1bc1524bf8bcd3bf --- /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 0000000000000000000000000000000000000000..e1ce1cb04fafef1e8808dfccb7e8151116690026 --- /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 0000000000000000000000000000000000000000..8fd333f28a4c20a3c558d20876d0c002d5d694c2 --- /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 0000000000000000000000000000000000000000..51261e3493e9f752548aabc3691f8341a5a448e4 --- /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 0000000000000000000000000000000000000000..2ea37e1a6a5c35e908207fc6793c2c1a79e9eb10 --- /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 0000000000000000000000000000000000000000..698bee0b3422373db3a76598a69c22021e134d3c --- /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 0000000000000000000000000000000000000000..671d5eb39e879fe37d06bd5f7ab7814ca55e71d4 --- /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 0000000000000000000000000000000000000000..7c13a22f7bf9a30f29d03cdb32ed2dc922ac2c55 --- /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 0000000000000000000000000000000000000000..94eb16a6ed09a09f2ddc5867b7905d7ff39da895 --- /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 0000000000000000000000000000000000000000..4d0e6a026aa3748c362484d6bd06dcabe3b2b267 --- /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 0000000000000000000000000000000000000000..43b10f087244710a138c0a493980361ef8eb1151 --- /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 0000000000000000000000000000000000000000..618e273934073310422359c768aff673f048e098 --- /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 0000000000000000000000000000000000000000..0078c8945a7da473556bb9f1cb34395ee174a184 --- /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 0000000000000000000000000000000000000000..8cb93bf509431a82c4242a0c9931f1c467819ada --- /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 0000000000000000000000000000000000000000..b549163ba8b5492065fe103c3143d4fdd4dbbeca --- /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 0000000000000000000000000000000000000000..cb9b644b982034e4730ab22cd8119bd350c0519e --- /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 0000000000000000000000000000000000000000..8c001b59e23dadd6adf32f5cf0d9bc52e35c2d6b --- /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 0000000000000000000000000000000000000000..db9d8681224e273228839d58f366d9216903746e --- /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 0000000000000000000000000000000000000000..88329f3ca79f7b61b42f2f3d377c6fe1e0820a1c --- /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 0000000000000000000000000000000000000000..2c9d9382cf1fb3533d11f31c5e698ce3fd9ca942 --- /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 0000000000000000000000000000000000000000..d26f4ea09b18b9dba1dba6f498d971d16f901b64 --- /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 0000000000000000000000000000000000000000..e166c1e33827ef7f2b2df71d11868da025b13bee --- /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 0000000000000000000000000000000000000000..7a4205213d084c7723f9f0e58c726656ddad93bf --- /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 0000000000000000000000000000000000000000..4177df7a08af8a736a0a869858ec72f81470e420 --- /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 0000000000000000000000000000000000000000..62ee9b59bc7cdba6d6b048056c39fdba17bc8959 --- /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 0000000000000000000000000000000000000000..58f19bd49cb954ea8543a748c8fd0ef903b08105 --- /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 0000000000000000000000000000000000000000..1371cb652e0f7e7742e125e0ac971827d117233f --- /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 0000000000000000000000000000000000000000..754348b0d407a2f2aa9c683f560405d94a3a2bb2 --- /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 0000000000000000000000000000000000000000..247c04516704925e61176ccecb51c15afd9bc627 --- /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 0000000000000000000000000000000000000000..6d6c6b174c113899849fc4f597ade09a0e46a27f --- /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 0000000000000000000000000000000000000000..505e813312bfb7336c1f555779a1f0481685de65 --- /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 0000000000000000000000000000000000000000..da3dbf68581b4d627e1b1e1e7680efc77abdb2d6 --- /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 0000000000000000000000000000000000000000..4a43adaab53b22bb21665e52dfbd5061452bcb63 --- /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 0000000000000000000000000000000000000000..8f8277bb1b23fc0c846affe81abed2149faad4ee --- /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 0000000000000000000000000000000000000000..f97faa1c65a569d5aee363af8f40e6c4f966a160 --- /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 0000000000000000000000000000000000000000..58db4909b1838b7d7d81ee2de3776d5017c5d3fd --- /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 0000000000000000000000000000000000000000..820cc19245ba88325cf8de2d326db0b41c61c5ee --- /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 0000000000000000000000000000000000000000..0644a6b91695940a77dbb5cc0848d2f5e9f2ef07 --- /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 0000000000000000000000000000000000000000..3df8bf253d5bc11249a9d98d3d220afe991e9c4d --- /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 0000000000000000000000000000000000000000..84a701adbf76767e5d7a2c748151d2041a64a821 --- /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 0000000000000000000000000000000000000000..e2b94d4c6c6c48312d74cc366fdb7d0fb4f456e5 --- /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 0000000000000000000000000000000000000000..8eb78f61653ed21758e3fe37332bc21d742b0a20 --- /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 0000000000000000000000000000000000000000..f431232625bd3e2eb4fe8190fd5313d4e4c5ec95 --- /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 0000000000000000000000000000000000000000..bca7a580500f5ed4cb618e0c1e16eb9360bc9893 --- /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 0000000000000000000000000000000000000000..732fba2e74caa6ceb0f9ae26cb5ab3adafdc1ce3 --- /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 0000000000000000000000000000000000000000..d01110a7a9ba158de8453a368380e08eb3572951 --- /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 0000000000000000000000000000000000000000..f861b471c53f64e59d9c429e91687408d0e7ba82 --- /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 }