diff options
Diffstat (limited to 'js/src/tests/test262/language/statements/class/elements/syntax/valid')
30 files changed, 1199 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/browser.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/browser.js diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js new file mode 100644 index 0000000000..fdf55541d9 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js @@ -0,0 +1,24 @@ +// 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.template +/*--- +description: A constructor is valid without a super call in the constructor and heritage (class declaration) +esid: prod-ClassElement +features: [class] +flags: [generated] +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. + +---*/ + + +class C { + constructor() {} +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-accessor.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-accessor.js new file mode 100644 index 0000000000..eafce8744d --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-accessor.js @@ -0,0 +1,27 @@ +// |reftest| skip -- decorators is not supported +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-accessor.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template +/*--- +description: Valid accessor FieldDefinition, ClassElementName, PropertyName Syntax (class declaration) +esid: prod-ClassElement +features: [decorators, class] +flags: [generated] +info: | + FieldDefinition[Yield, Await] : + ClassElementName[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt + accessor [no LineTerminator here] ClassElementName[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt + +---*/ + + +class C { + accessor $; + accessor _; + accessor \u{6F}; + accessor \u2118; + accessor ZW_\u200C_NJ; + accessor ZW_\u200D_J; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js new file mode 100644 index 0000000000..d0b8f03ba4 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js @@ -0,0 +1,72 @@ +// 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.template +/*--- +description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class declaration) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +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 + <ZWNJ> <ZWJ> + + 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". + +---*/ + + +class C { + $ = 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 +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer.js new file mode 100644 index 0000000000..143e21ced4 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer.js @@ -0,0 +1,72 @@ +// 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.template +/*--- +description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class declaration) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +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 + <ZWNJ> <ZWJ> + + 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". + +---*/ + + +class C { + $ = 1; + _ = 2; + \u{6F} = 3; + \u2118 = 4; + ZW_\u200C_NJ = 5; + ZW_\u200D_J = 6; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier-alt.js new file mode 100644 index 0000000000..37c11e23d8 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier-alt.js @@ -0,0 +1,72 @@ +// 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.template +/*--- +description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +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 + <ZWNJ> <ZWJ> + + 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". + +---*/ + + +class C { + $; + _; + \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 +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier.js new file mode 100644 index 0000000000..0151ed8286 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier.js @@ -0,0 +1,72 @@ +// 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.template +/*--- +description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +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 + <ZWNJ> <ZWJ> + + 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". + +---*/ + + +class C { + $; + _; + \u{6F}; + \u2118; + ZW_\u200C_NJ; + ZW_\u200D_J; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-fields-multi-line.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-fields-multi-line.js new file mode 100644 index 0000000000..73bde20af2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-fields-multi-line.js @@ -0,0 +1,31 @@ +// 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.template +/*--- +description: Valid multi-line, multi-field (class declaration) +esid: prod-ClassElement +features: [class-fields-public, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + +---*/ + + +class C { + x + y +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js new file mode 100644 index 0000000000..482b6920dd --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js @@ -0,0 +1,23 @@ +// 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.template +/*--- +description: It's valid if a class contains a private getter and a private setter with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +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. + +---*/ + + +class C { + get #m() {} + set #m(_) {} +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js new file mode 100644 index 0000000000..ef9ea621c2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js @@ -0,0 +1,28 @@ +// 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.template +/*--- +description: It's valid if a nested class shadows a private method (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +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. + +---*/ + + +class C { + constructor() { + class B { + #m() {} + } + } + + #m() {} +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js new file mode 100644 index 0000000000..c741b7755d --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js @@ -0,0 +1,69 @@ +// 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.template +/*--- +description: Valid PrivateName = Initializer Syntax (class declaration) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +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 + <ZWNJ> <ZWJ> + + 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". + +---*/ + + +class C { + #$ = 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 +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js new file mode 100644 index 0000000000..e80e425b7e --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js @@ -0,0 +1,69 @@ +// 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.template +/*--- +description: Valid PrivateName = Initializer Syntax (class declaration) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +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 + <ZWNJ> <ZWJ> + + 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". + +---*/ + + +class C { + #$ = 1; + #_ = 2; + #\u{6F} = 3; + #\u2118 = 4; + #ZW_\u200C_NJ = 5; + #ZW_\u200D_J = 6; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-identifier.js new file mode 100644 index 0000000000..d0166b4b60 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-identifier.js @@ -0,0 +1,66 @@ +// 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.template +/*--- +description: Valid PrivateName Syntax (class declaration) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +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 + <ZWNJ> <ZWJ> + + 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". + +---*/ + + +class C { + #$; + #_; + #\u{6F}; + #\u2118; + #ZW_\u200C_NJ; + #ZW_\u200D_J; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js new file mode 100644 index 0000000000..200f8b280e --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js @@ -0,0 +1,34 @@ +// 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.template +/*--- +description: SyntaxError (class declaration) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +class C { + #x + m() {} +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatenames-multi-line.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatenames-multi-line.js new file mode 100644 index 0000000000..e00ef3ed47 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatenames-multi-line.js @@ -0,0 +1,34 @@ +// 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.template +/*--- +description: SyntaxError (class declaration) +esid: prod-ClassElement +features: [class-fields-private, class] +flags: [generated] +info: | + ClassElement : + MethodDefinition + static MethodDefinition + FieldDefinition ; + ; + + FieldDefinition : + ClassElementName Initializer _opt + + ClassElementName : + PropertyName + PrivateName + + PrivateName :: + # IdentifierName + +---*/ + + +class C { + #x + #y +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js new file mode 100644 index 0000000000..d3cb1b1ce1 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-accessor-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template +/*--- +description: Accessor Methods can be named "prototype" (class declaration) +esid: prod-ClassElement +features: [class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + MethodDefinition : get PropertyName ( ) { FunctionBody } + + [...] + 9. Let desc be the PropertyDescriptor { [[Get]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 10. Return ? DefinePropertyOrThrow(object, propKey, desc). + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + [...] + 8. Let desc be the PropertyDescriptor { [[Set]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 9. Return ? DefinePropertyOrThrow(object, propKey, desc). + +---*/ + + +class C { + get prototype() { return 13; } + set prototype(_) {} +} + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +assert.sameValue(C.prototype.prototype, 13); +verifyProperty(C.prototype, 'prototype', { + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js new file mode 100644 index 0000000000..2c7e0c8f6d --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-async-gen-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template +/*--- +description: Async Generator Methods can be named "prototype" (class declaration) +esid: prod-ClassElement +features: [async-iteration, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + [...] + 10. Let desc be PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 11. Return ? DefinePropertyOrThrow(object, propKey, desc). + +---*/ + + +class C { + async * prototype() {} +} + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +verifyProperty(C.prototype, 'prototype', { + writable: true, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js new file mode 100644 index 0000000000..17fa1970f5 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-async-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template +/*--- +description: Async Methods can be named "prototype" (class declaration) +esid: prod-ClassElement +features: [async-functions, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + [...] + 8. Let desc be the PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 9. Return ? DefinePropertyOrThrow(object, propKey, desc). + +---*/ + + +class C { + async prototype() {} +} + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +verifyProperty(C.prototype, 'prototype', { + writable: true, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js new file mode 100644 index 0000000000..ac18e1f825 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-gen-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template +/*--- +description: Generator Methods can be named "prototype" (class declaration) +esid: prod-ClassElement +features: [generators, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + [...] + 10. Let desc be the PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 11. Return ? DefinePropertyOrThrow(object, propKey, desc). + +---*/ + + +class C { + * prototype() {} +} + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +verifyProperty(C.prototype, 'prototype', { + writable: true, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js new file mode 100644 index 0000000000..04ecfae0a3 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-special-prototype-meth-valid.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template +/*--- +description: Methods can be named "prototype" (class declaration) +esid: prod-ClassElement +features: [class] +flags: [generated] +includes: [propertyHelper.js] +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage_opt { ClassBody_opt } + + [...] + 6. Let proto be OrdinaryObjectCreate(protoParent). + [...] + 14. Perform MakeConstructor(F, false, proto). + [...] + 20. For each ClassElement m in order from methods, do + a. If IsStatic of m is false, then + i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + With parameters object and enumerable. + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + [...] + 3. Let desc be the PropertyDescriptor { [[Value]]: methodDef.[[Closure]], [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }. + 4. Return ? DefinePropertyOrThrow(object, methodDef.[[Key]], desc). + +---*/ + + +class C { + prototype() {} +} + +assert(C.hasOwnProperty('prototype')); +assert(C.prototype.hasOwnProperty('prototype')); +assert.notSameValue(C.prototype.prototype, C.prototype); +verifyProperty(C.prototype, 'prototype', { + writable: true, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js new file mode 100644 index 0000000000..50394530b3 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js @@ -0,0 +1,32 @@ +// 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.template +/*--- +description: Static Accessor Methods can be named constructor (class declaration) +esid: prod-ClassElement +features: [class] +flags: [generated] +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". + +---*/ + + +class C { + 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js new file mode 100644 index 0000000000..59d173ff32 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js @@ -0,0 +1,31 @@ +// 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.template +/*--- +description: Static Async Generator Methods can be named constructor (class declaration) +esid: prod-ClassElement +features: [async-iteration, class] +flags: [generated] +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". + +---*/ + + +class C { + 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js new file mode 100644 index 0000000000..47fbf0c78f --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js @@ -0,0 +1,31 @@ +// 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.template +/*--- +description: Static Methods can be named constructor (class declaration) +esid: prod-ClassElement +features: [async-functions, class] +flags: [generated] +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". + +---*/ + + +class C { + 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js new file mode 100644 index 0000000000..24f54213ef --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js @@ -0,0 +1,31 @@ +// 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.template +/*--- +description: Static Generator Methods can be named constructor (class declaration) +esid: prod-ClassElement +features: [generators, class] +flags: [generated] +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". + +---*/ + + +class C { + static * constructor() {} + constructor() {} // stacks with a valid constructor +} + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js new file mode 100644 index 0000000000..7b778bc72b --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js @@ -0,0 +1,31 @@ +// 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.template +/*--- +description: Static Methods can be named constructor (class declaration) +esid: prod-ClassElement +features: [class] +flags: [generated] +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". + +---*/ + + +class C { + static constructor() {} + constructor() {} // stacks with a valid constructor +} + +assert(C.hasOwnProperty('constructor')); +assert(C.prototype.hasOwnProperty('constructor')); +assert.notSameValue(C.prototype.constructor, C.constructor); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js new file mode 100644 index 0000000000..7c7b26a27d --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js @@ -0,0 +1,22 @@ +// 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.template +/*--- +description: Static Async Generator Private Methods can be named "#prototype" (class declaration) +esid: prod-ClassElement +features: [async-iteration, class-static-methods-private, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +class C { + static async * #prototype() {} +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js new file mode 100644 index 0000000000..445dea39c6 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js @@ -0,0 +1,22 @@ +// 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.template +/*--- +description: Static Async Private Methods can be named "#prototype" (class declaration) +esid: prod-ClassElement +features: [async-functions, class-static-methods-private, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +class C { + static async #prototype() {} +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js new file mode 100644 index 0000000000..5a15aae437 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js @@ -0,0 +1,22 @@ +// 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.template +/*--- +description: Static Generator Private Methods can be named "#prototype" (class declaration) +esid: prod-ClassElement +features: [generators, class-static-methods-private, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +class C { + static * #prototype() {} +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-meth-prototype.js new file mode 100644 index 0000000000..6907ef0886 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-meth-prototype.js @@ -0,0 +1,22 @@ +// 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.template +/*--- +description: Static Private Methods can be named "#prototype" (class declaration) +esid: prod-ClassElement +features: [class-static-methods-private, class] +flags: [generated] +info: | + Class Definitions / Static Semantics: Early Errors + + ClassElement : static MethodDefinition + It is a Syntax Error if PropName of MethodDefinition is "prototype" + +---*/ + + +class C { + static #prototype() {} +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/shell.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/shell.js |