diff options
Diffstat (limited to 'js/src/tests/test262/language/statements/class/accessor-name-inst')
23 files changed, 861 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/browser.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/browser.js diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-evaluation.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-evaluation.js new file mode 100644 index 0000000000..6b2789e7b7 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-evaluation.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-evaluation.case +// - src/accessor-names/error/cls-decl-inst.template +/*--- +description: Abrupt completion when evaluating expression (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get [thrower()]() {} + } +}, '`get` accessor'); + +assert.throws(Test262Error, function() { + class C { + set [thrower()](_) {} + } +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-to-prop-key.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-to-prop-key.js new file mode 100644 index 0000000000..bad284dd3a --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-to-prop-key.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-to-prop-key.case +// - src/accessor-names/error/cls-decl-inst.template +/*--- +description: Abrupt completion when coercing to property key value (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get [badKey]() {} + } +}, '`get` accessor'); + +assert.throws(TypeError, function() { + class C { + set [badKey](_) {} + } +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-unresolvable.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-unresolvable.js new file mode 100644 index 0000000000..55e183a385 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-unresolvable.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-unresolvable.case +// - src/accessor-names/error/cls-decl-inst.template +/*--- +description: Abrupt completion when resolving reference value (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get [test262unresolvable]() {} + } +}, '`get` accessor'); + +assert.throws(ReferenceError, function() { + class C { + set [test262unresolvable](_) {} + } +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/computed.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed.js new file mode 100644 index 0000000000..b11ca09cff --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (AssignmentExpression) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get [_ = 'str' + 'ing']() { return 'get string'; } + set [_ = 'str' + 'ing'](param) { stringSet = param; } +} + +assert.sameValue(C.prototype['string'], 'get string'); + +C.prototype['string'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-binary.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-binary.js new file mode 100644 index 0000000000..1dd543dfbd --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-binary.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-binary.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in binary notation) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 0b10() { return 'get string'; } + set 0b10(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['2'], 'get string'); + +C.prototype['2'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-exponent.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-exponent.js new file mode 100644 index 0000000000..f6bbea1eb1 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-exponent.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-exponent.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in exponent notation) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 1E+9() { return 'get string'; } + set 1E+9(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['1000000000'], 'get string'); + +C.prototype['1000000000'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-hex.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-hex.js new file mode 100644 index 0000000000..7ab75e0fad --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-hex.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-hex.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 0x10() { return 'get string'; } + set 0x10(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['16'], 'get string'); + +C.prototype['16'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-leading-decimal.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..c70cf03231 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-leading-decimal.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-leading-decimal.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (numeric literal with leading decimal point) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get .1() { return 'get string'; } + set .1(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['0.1'], 'get string'); + +C.prototype['0.1'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-non-canonical.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-non-canonical.js new file mode 100644 index 0000000000..69513c97d0 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-non-canonical.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-non-canonical.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (numeric literal with non-canonical representation) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 0.0000001() { return 'get string'; } + set 0.0000001(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['1e-7'], 'get string'); + +C.prototype['1e-7'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-octal.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-octal.js new file mode 100644 index 0000000000..08eff48f90 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-octal.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-octal.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in octal notation) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 0o10() { return 'get string'; } + set 0o10(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['8'], 'get string'); + +C.prototype['8'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-zero.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-zero.js new file mode 100644 index 0000000000..d062be1fcf --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-zero.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-zero.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (numeric literal zero) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 0() { return 'get string'; } + set 0(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['0'], 'get string'); + +C.prototype['0'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-char-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-char-escape.js new file mode 100644 index 0000000000..88960560e3 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-char-escape.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-char-escape.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal containing a character escape sequence) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 'character\tescape'() { return 'get string'; } + set 'character\tescape'(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['character escape'], 'get string'); + +C.prototype['character escape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped-ext.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped-ext.js new file mode 100644 index 0000000000..68f36541d8 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped-ext.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped-ext.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal 'default' w/ extended escape) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 'def\u{61}ult'() { return 'get string'; } + set 'def\u{61}ult'(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['default'], 'get string'); + +C.prototype['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped.js new file mode 100644 index 0000000000..e133e30efd --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal 'default' escaped) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 'def\u0061ult'() { return 'get string'; } + set 'def\u0061ult'(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['default'], 'get string'); + +C.prototype['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default.js new file mode 100644 index 0000000000..152e02fb3c --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal 'default') (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 'default'() { return 'get string'; } + set 'default'(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['default'], 'get string'); + +C.prototype['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-double-quote.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-double-quote.js new file mode 100644 index 0000000000..6b1b5d8361 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-double-quote.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-double-quote.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal using double quotes) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get "doubleQuote"() { return 'get string'; } + set "doubleQuote"(param) { stringSet = param; } +} + +assert.sameValue(C.prototype["doubleQuote"], 'get string'); + +C.prototype["doubleQuote"] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-empty.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-empty.js new file mode 100644 index 0000000000..fa579f4173 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-empty.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-empty.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal, the empty string) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get ''() { return 'get string'; } + set ''(param) { stringSet = param; } +} + +assert.sameValue(C.prototype[''], 'get string'); + +C.prototype[''] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-hex-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-hex-escape.js new file mode 100644 index 0000000000..37fa2404b8 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-hex-escape.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-hex-escape.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 'hex\x45scape'() { return 'get string'; } + set 'hex\x45scape'(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['hexEscape'], 'get string'); + +C.prototype['hexEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-line-continuation.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-line-continuation.js new file mode 100644 index 0000000000..6208971eb6 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-line-continuation.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-line-continuation.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal containing LineContinuation) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 'line\ +Continuation'() { return 'get string'; } + set 'line\ +Continuation'(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['lineContinuation'], 'get string'); + +C.prototype['lineContinuation'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-single-quote.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-single-quote.js new file mode 100644 index 0000000000..f6ef6c5fc6 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-single-quote.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-single-quote.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal using single quotes) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 'singleQuote'() { return 'get string'; } + set 'singleQuote'(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['singleQuote'], 'get string'); + +C.prototype['singleQuote'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-unicode-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-unicode-escape.js new file mode 100644 index 0000000000..d14a6d3d0d --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-unicode-escape.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-unicode-escape.case +// - src/accessor-names/default/cls-decl-inst.template +/*--- +description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Class declaration, instance 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 + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto 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 { + get 'unicod\u{000065}Escape'() { return 'get string'; } + set 'unicod\u{000065}Escape'(param) { stringSet = param; } +} + +assert.sameValue(C.prototype['unicodeEscape'], 'get string'); + +C.prototype['unicodeEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/shell.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/shell.js |