diff options
Diffstat (limited to 'js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names')
30 files changed, 1400 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/browser.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/browser.js diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js new file mode 100644 index 0000000000..40c53ece98 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js new file mode 100644 index 0000000000..68341532c1 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js new file mode 100644 index 0000000000..615c5a91d8 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js new file mode 100644 index 0000000000..953d7c6f8f --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js new file mode 100644 index 0000000000..060ba0152f --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js new file mode 100644 index 0000000000..c2852bb8a7 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js new file mode 100644 index 0000000000..4db6d17b25 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js new file mode 100644 index 0000000000..cec95a1460 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js new file mode 100644 index 0000000000..06d1a91584 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js @@ -0,0 +1,58 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js new file mode 100644 index 0000000000..483a835d70 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js @@ -0,0 +1,58 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js new file mode 100644 index 0000000000..dce5883462 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js @@ -0,0 +1,58 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js new file mode 100644 index 0000000000..fb8dceaf2f --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js @@ -0,0 +1,58 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js new file mode 100644 index 0000000000..a3b8d6b0f4 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js new file mode 100644 index 0000000000..6596ef5dc0 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js new file mode 100644 index 0000000000..7296cac6a2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js new file mode 100644 index 0000000000..13559da5b6 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js new file mode 100644 index 0000000000..023631b29a --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js new file mode 100644 index 0000000000..7ea61ba52a --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js new file mode 100644 index 0000000000..e43b5446e5 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js new file mode 100644 index 0000000000..ce7669e83f --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js new file mode 100644 index 0000000000..0eeb130e09 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js new file mode 100644 index 0000000000..dea9d1d473 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js new file mode 100644 index 0000000000..bae36e873a --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js new file mode 100644 index 0000000000..baf7573389 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js new file mode 100644 index 0000000000..b66bdcf9fd --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js new file mode 100644 index 0000000000..7d989a3e74 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js new file mode 100644 index 0000000000..8c6ffeb17a --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js new file mode 100644 index 0000000000..41926b597c --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// 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/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/shell.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/shell.js |