diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-class-body-ctor-no-heritage.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-class-body-ctor-no-heritage.js new file mode 100644 index 0000000000..338c84c482 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-class-body-ctor-no-heritage.js @@ -0,0 +1,22 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-class-body-ctor-no-heritage.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: A constructor is valid without a super call in the constructor and heritage (class declaration module default export) +esid: prod-ClassElement +features: [class] +flags: [generated, module] +info: | + ClassTail : ClassHeritageopt { ClassBody } + + It is a Syntax Error if ClassHeritage is not present and the following algorithm evaluates to true: + 1. Let constructor be ConstructorMethod of ClassBody. + 2. If constructor is empty, return false. + 3. Return HasDirectSuper of constructor. + +---*/ + + +export default class { + constructor() {} +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-classelementname-initializer-alt.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-classelementname-initializer-alt.js new file mode 100644 index 0000000000..bd2d36b4d1 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-classelementname-initializer-alt.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-classelementname-initializer-alt.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated, module] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +export default class { + $ = 1; + _ = 2; + \u{6F} = 3; + ℘ = 4; // DO NOT CHANGE THE NAME OF THIS FIELD + ZW_‌_NJ = 5; // DO NOT CHANGE THE NAME OF THIS FIELD + ZW_‍_J = 6; // DO NOT CHANGE THE NAME OF THIS FIELD +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-classelementname-initializer.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-classelementname-initializer.js new file mode 100644 index 0000000000..1622c276ff --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-classelementname-initializer.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-classelementname-initializer.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated, module] +info: | + ClassElement : + ... + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +export default class { + $ = 1; + _ = 2; + \u{6F} = 3; + \u2118 = 4; + ZW_\u200C_NJ = 5; + ZW_\u200D_J = 6; +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-identifier-alt.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-identifier-alt.js new file mode 100644 index 0000000000..46d176a57d --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-identifier-alt.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-identifier-alt.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated, module] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + StringLiteral + NumericLiteral + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +export default class { + $; + _; + \u{6F}; + ℘; // DO NOT CHANGE THE NAME OF THIS FIELD + ZW_‌_NJ; // DO NOT CHANGE THE NAME OF THIS FIELD + ZW_‍_J; // DO NOT CHANGE THE NAME OF THIS FIELD +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-identifier.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-identifier.js new file mode 100644 index 0000000000..3c4c4dc23a --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-field-identifier.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-identifier.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated, module] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PropertyName : + LiteralPropertyName + ComputedPropertyName + + LiteralPropertyName : + IdentifierName + StringLiteral + NumericLiteral + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart :: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart :: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue :: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +export default class { + $; + _; + \u{6F}; + \u2118; + ZW_\u200C_NJ; + ZW_\u200D_J; +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-fields-multi-line.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-fields-multi-line.js new file mode 100644 index 0000000000..6b233a01ec --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-fields-multi-line.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-fields-multi-line.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Valid multi-line, multi-field (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated, module] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + +---*/ + + +export default class { + x + y +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatemeth-duplicate-get-set.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatemeth-duplicate-get-set.js new file mode 100644 index 0000000000..628cea5bf3 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatemeth-duplicate-get-set.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-set.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: It's valid if a class contains a private getter and a private setter with the same name (class declaration module default export) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated, module] +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +export default class { + get #m() {} + set #m(_) {} +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatemeth-duplicate-meth-nestedclassmeth.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatemeth-duplicate-meth-nestedclassmeth.js new file mode 100644 index 0000000000..9b3c03c4b1 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatemeth-duplicate-meth-nestedclassmeth.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-nestedclassmeth.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: It's valid if a nested class shadows a private method (class declaration module default export) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated, module] +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +export default class { + constructor() { + class B { + #m() {} + } + } + + #m() {} +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-classelementname-initializer-alt.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-classelementname-initializer-alt.js new file mode 100644 index 0000000000..a953b96f75 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-classelementname-initializer-alt.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-classelementname-initializer-alt.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Valid PrivateName = Initializer Syntax (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated, module] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +export default class { + #$ = 1; + #_ = 2; + #\u{6F} = 3; + #℘ = 4; // DO NOT CHANGE THE NAME OF THIS FIELD + #ZW_‌_NJ = 5; // DO NOT CHANGE THE NAME OF THIS FIELD + #ZW_‍_J = 6; // DO NOT CHANGE THE NAME OF THIS FIELD +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-classelementname-initializer.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-classelementname-initializer.js new file mode 100644 index 0000000000..a9fdcb5bad --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-classelementname-initializer.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-classelementname-initializer.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Valid PrivateName = Initializer Syntax (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated, module] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + Initializer : + = AssignmentExpression + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +export default class { + #$ = 1; + #_ = 2; + #\u{6F} = 3; + #\u2118 = 4; + #ZW_\u200C_NJ = 5; + #ZW_\u200D_J = 6; +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-identifier.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-identifier.js new file mode 100644 index 0000000000..6d39402efa --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-identifier.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-identifier.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Valid PrivateName Syntax (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated, module] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + + IdentifierName :: + IdentifierStart + IdentifierName IdentifierPart + + IdentifierStart :: + UnicodeIDStart + $ + _ + \ UnicodeEscapeSequence + + IdentifierPart:: + UnicodeIDContinue + $ + \ UnicodeEscapeSequence + + + UnicodeIDStart:: + any Unicode code point with the Unicode property "ID_Start" + + UnicodeIDContinue:: + any Unicode code point with the Unicode property "ID_Continue" + + + NOTE 3 + The sets of code points with Unicode properties "ID_Start" and + "ID_Continue" include, respectively, the code points with Unicode + properties "Other_ID_Start" and "Other_ID_Continue". + +---*/ + + +export default class { + #$; + #_; + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J; +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-no-initializer-with-method.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-no-initializer-with-method.js new file mode 100644 index 0000000000..9aea6cba10 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatename-no-initializer-with-method.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatename-no-initializer-with-method.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: SyntaxError (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated, module] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +export default class { + #x + m() {} +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatenames-multi-line.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatenames-multi-line.js new file mode 100644 index 0000000000..1992d92b85 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-privatenames-multi-line.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatenames-multi-line.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: SyntaxError (class declaration module default export) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated, module] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +export default class { + #x + #y +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-accessor-meth-valid.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-accessor-meth-valid.js new file mode 100644 index 0000000000..69f8092e52 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-accessor-meth-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-accessor-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Static Accessor Methods can be named constructor (class declaration module default export) +esid: prod-ClassElement +features: [class] +flags: [generated, module] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +export default class { + static get constructor() {} + static set constructor(_) {} + constructor() {} // stacks with a valid constructor +} + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-async-gen-meth-valid.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-async-gen-meth-valid.js new file mode 100644 index 0000000000..186accd5bc --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-async-gen-meth-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-async-gen-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Static Async Generator Methods can be named constructor (class declaration module default export) +esid: prod-ClassElement +features: [async-iteration, class] +flags: [generated, module] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +export default class { + static async * constructor() {} + constructor() {} // stacks with a valid constructor +} + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-async-meth-valid.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-async-meth-valid.js new file mode 100644 index 0000000000..4968978f7b --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-async-meth-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-async-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Static Methods can be named constructor (class declaration module default export) +esid: prod-ClassElement +features: [async-functions, class] +flags: [generated, module] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +export default class { + static async constructor() {} + constructor() {} // stacks with a valid constructor +} + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-gen-meth-valid.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-gen-meth-valid.js new file mode 100644 index 0000000000..07c2adf951 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-gen-meth-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-gen-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Static Generator Methods can be named constructor (class declaration module default export) +esid: prod-ClassElement +features: [generators, class] +flags: [generated, module] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +export default class { + static * constructor() {} + constructor() {} // stacks with a valid constructor +} + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-meth-valid.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-meth-valid.js new file mode 100644 index 0000000000..b65cd60064 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-ctor-meth-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-ctor-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Static Methods can be named constructor (class declaration module default export) +esid: prod-ClassElement +features: [class] +flags: [generated, module] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true. + ClassElement : static MethodDefinition + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. + It is a Syntax Error if PropName of MethodDefinition is "prototype". + +---*/ + + +export default class { + static constructor() {} + constructor() {} // stacks with a valid constructor +} + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-async-gen-meth-prototype.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-async-gen-meth-prototype.js new file mode 100644 index 0000000000..4f57888a0e --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-async-gen-meth-prototype.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-async-gen-meth-prototype.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Static Async Generator Private Methods can be named "#prototype" (class declaration module default export) +esid: prod-ClassElement +features: [async-iteration, class-static-methods-private, class] +flags: [generated, module] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +export default class { + static async * #prototype() {} +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-async-meth-prototype.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-async-meth-prototype.js new file mode 100644 index 0000000000..f73a12c647 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-async-meth-prototype.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-async-meth-prototype.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Static Async Private Methods can be named "#prototype" (class declaration module default export) +esid: prod-ClassElement +features: [async-functions, class-static-methods-private, class] +flags: [generated, module] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +export default class { + static async #prototype() {} +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-gen-meth-prototype.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-gen-meth-prototype.js new file mode 100644 index 0000000000..8630901996 --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-gen-meth-prototype.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-gen-meth-prototype.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Static Generator Private Methods can be named "#prototype" (class declaration module default export) +esid: prod-ClassElement +features: [generators, class-static-methods-private, class] +flags: [generated, module] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +export default class { + static * #prototype() {} +} diff --git a/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-meth-prototype.js b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-meth-prototype.js new file mode 100644 index 0000000000..8d19ff062e --- /dev/null +++ b/test/language/statements/class/elements/syntax/valid/export-default-grammar-static-private-meth-prototype.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-static-private-meth-prototype.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template +/*--- +description: Static Private Methods can be named "#prototype" (class declaration module default export) +esid: prod-ClassElement +features: [class-static-methods-private, class] +flags: [generated, module] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +export default class { + static #prototype() {} +}