diff options
Diffstat (limited to 'js/src/tests/test262/language/statements/class/accessor-name-static')
23 files changed, 903 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/browser.js b/js/src/tests/test262/language/statements/class/accessor-name-static/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/browser.js diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-evaluation.js b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-evaluation.js new file mode 100644 index 0000000000..8541304f43 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-evaluation.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-evaluation.case +// - src/accessor-names/error/cls-decl-static.template +/*--- +description: Abrupt completion when evaluating expression (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). +---*/ +var thrower = function() { + throw new Test262Error(); +}; + + +assert.throws(Test262Error, function() { + class C { + static get [thrower()]() {} + } +}, '`get` accessor'); + +assert.throws(Test262Error, function() { + class C { + static set [thrower()](_) {} + } +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-to-prop-key.js b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-to-prop-key.js new file mode 100644 index 0000000000..57e250e59c --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-to-prop-key.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-to-prop-key.case +// - src/accessor-names/error/cls-decl-static.template +/*--- +description: Abrupt completion when coercing to property key value (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + + 7.1.14 ToPropertyKey + + 1. Let key be ? ToPrimitive(argument, hint String). + + 7.1.1 ToPrimitive + + [...] + 7. Return ? OrdinaryToPrimitive(input, hint). + + 7.1.1.1 OrdinaryToPrimitive + + 5. For each name in methodNames in List order, do + [...] + 6. Throw a TypeError exception. +---*/ +var badKey = Object.create(null); + + +assert.throws(TypeError, function() { + class C { + static get [badKey]() {} + } +}, '`get` accessor'); + +assert.throws(TypeError, function() { + class C { + static set [badKey](_) {} + } +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-unresolvable.js b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-unresolvable.js new file mode 100644 index 0000000000..c049096333 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-unresolvable.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-unresolvable.case +// - src/accessor-names/error/cls-decl-static.template +/*--- +description: Abrupt completion when resolving reference value (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). +---*/ + +assert.throws(ReferenceError, function() { + class C { + static get [test262unresolvable]() {} + } +}, '`get` accessor'); + +assert.throws(ReferenceError, function() { + class C { + static set [test262unresolvable](_) {} + } +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/computed.js b/js/src/tests/test262/language/statements/class/accessor-name-static/computed.js new file mode 100644 index 0000000000..e8284e4c2c --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/computed.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (AssignmentExpression) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ +var _; + + +var stringSet; + +class C { + static get [_ = 'str' + 'ing']() { return 'get string'; } + static set [_ = 'str' + 'ing'](param) { stringSet = param; } +} + +assert.sameValue(C['string'], 'get string'); + +C['string'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-binary.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-binary.js new file mode 100644 index 0000000000..eba3b2b1bb --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-binary.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-binary.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (numeric literal in binary notation) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 0b10() { return 'get string'; } + static set 0b10(param) { stringSet = param; } +} + +assert.sameValue(C['2'], 'get string'); + +C['2'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-exponent.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-exponent.js new file mode 100644 index 0000000000..309c418790 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-exponent.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-exponent.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (numeric literal in exponent notation) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 1E+9() { return 'get string'; } + static set 1E+9(param) { stringSet = param; } +} + +assert.sameValue(C['1000000000'], 'get string'); + +C['1000000000'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-hex.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-hex.js new file mode 100644 index 0000000000..aaeaa22988 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-hex.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-hex.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 0x10() { return 'get string'; } + static set 0x10(param) { stringSet = param; } +} + +assert.sameValue(C['16'], 'get string'); + +C['16'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-leading-decimal.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..21cdddc9a4 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-leading-decimal.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-leading-decimal.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (numeric literal with leading decimal point) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get .1() { return 'get string'; } + static set .1(param) { stringSet = param; } +} + +assert.sameValue(C['0.1'], 'get string'); + +C['0.1'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-non-canonical.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-non-canonical.js new file mode 100644 index 0000000000..86d8f2fd6f --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-non-canonical.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-non-canonical.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (numeric literal with non-canonical representation) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 0.0000001() { return 'get string'; } + static set 0.0000001(param) { stringSet = param; } +} + +assert.sameValue(C['1e-7'], 'get string'); + +C['1e-7'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-octal.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-octal.js new file mode 100644 index 0000000000..fa8b4e0505 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-octal.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-octal.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (numeric literal in octal notation) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 0o10() { return 'get string'; } + static set 0o10(param) { stringSet = param; } +} + +assert.sameValue(C['8'], 'get string'); + +C['8'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-zero.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-zero.js new file mode 100644 index 0000000000..18dfed2a88 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-zero.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-zero.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (numeric literal zero) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 0() { return 'get string'; } + static set 0(param) { stringSet = param; } +} + +assert.sameValue(C['0'], 'get string'); + +C['0'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-char-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-char-escape.js new file mode 100644 index 0000000000..30687691d0 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-char-escape.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-char-escape.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal containing a character escape sequence) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 'character\tescape'() { return 'get string'; } + static set 'character\tescape'(param) { stringSet = param; } +} + +assert.sameValue(C['character escape'], 'get string'); + +C['character escape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped-ext.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped-ext.js new file mode 100644 index 0000000000..3c04d8426d --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped-ext.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped-ext.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal 'default' w/ extended escape) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 'def\u{61}ult'() { return 'get string'; } + static set 'def\u{61}ult'(param) { stringSet = param; } +} + +assert.sameValue(C['default'], 'get string'); + +C['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped.js new file mode 100644 index 0000000000..64d6bdf455 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal 'default' escaped) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 'def\u0061ult'() { return 'get string'; } + static set 'def\u0061ult'(param) { stringSet = param; } +} + +assert.sameValue(C['default'], 'get string'); + +C['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default.js new file mode 100644 index 0000000000..88f60739e8 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal 'default') (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 'default'() { return 'get string'; } + static set 'default'(param) { stringSet = param; } +} + +assert.sameValue(C['default'], 'get string'); + +C['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-double-quote.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-double-quote.js new file mode 100644 index 0000000000..b7ec6e0e8b --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-double-quote.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-double-quote.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal using double quotes) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get "doubleQuote"() { return 'get string'; } + static set "doubleQuote"(param) { stringSet = param; } +} + +assert.sameValue(C["doubleQuote"], 'get string'); + +C["doubleQuote"] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-empty.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-empty.js new file mode 100644 index 0000000000..ed7767d1df --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-empty.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-empty.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal, the empty string) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get ''() { return 'get string'; } + static set ''(param) { stringSet = param; } +} + +assert.sameValue(C[''], 'get string'); + +C[''] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-hex-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-hex-escape.js new file mode 100644 index 0000000000..215a665e56 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-hex-escape.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-hex-escape.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 'hex\x45scape'() { return 'get string'; } + static set 'hex\x45scape'(param) { stringSet = param; } +} + +assert.sameValue(C['hexEscape'], 'get string'); + +C['hexEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-line-continuation.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-line-continuation.js new file mode 100644 index 0000000000..367e8f4c3c --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-line-continuation.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-line-continuation.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal containing LineContinuation) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 'line\ +Continuation'() { return 'get string'; } + static set 'line\ +Continuation'(param) { stringSet = param; } +} + +assert.sameValue(C['lineContinuation'], 'get string'); + +C['lineContinuation'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-single-quote.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-single-quote.js new file mode 100644 index 0000000000..f0c2272add --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-single-quote.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-single-quote.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal using single quotes) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 'singleQuote'() { return 'get string'; } + static set 'singleQuote'(param) { stringSet = param; } +} + +assert.sameValue(C['singleQuote'], 'get string'); + +C['singleQuote'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-unicode-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-unicode-escape.js new file mode 100644 index 0000000000..a428e5ba96 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-unicode-escape.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-unicode-escape.case +// - src/accessor-names/default/cls-decl-static.template +/*--- +description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Class declaration, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var stringSet; + +class C { + static get 'unicod\u{000065}Escape'() { return 'get string'; } + static set 'unicod\u{000065}Escape'(param) { stringSet = param; } +} + +assert.sameValue(C['unicodeEscape'], 'get string'); + +C['unicodeEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/shell.js b/js/src/tests/test262/language/statements/class/accessor-name-static/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-static/shell.js |