From 37d5f8e5efd2097c31de97f54ef413779b762590 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Sat, 28 Jan 2017 16:49:05 -0500 Subject: [PATCH] Re-generate tests --- ...essor-name-inst-computed-err-evaluation.js | 38 +++++++++++++ ...ssor-name-inst-computed-err-to-prop-key.js | 54 ++++++++++++++++++ ...sor-name-inst-computed-err-unresolvable.js | 36 ++++++++++++ .../class/accessor-name-inst-computed.js | 39 +++++++++++++ ...cessor-name-inst-literal-numeric-binary.js | 37 ++++++++++++ ...ssor-name-inst-literal-numeric-exponent.js | 37 ++++++++++++ .../accessor-name-inst-literal-numeric-hex.js | 37 ++++++++++++ ...me-inst-literal-numeric-leading-decimal.js | 37 ++++++++++++ ...name-inst-literal-numeric-non-canonical.js | 37 ++++++++++++ ...ccessor-name-inst-literal-numeric-octal.js | 37 ++++++++++++ ...accessor-name-inst-literal-numeric-zero.js | 37 ++++++++++++ ...or-name-inst-literal-string-char-escape.js | 37 ++++++++++++ ...r-name-inst-literal-string-double-quote.js | 37 ++++++++++++ ...accessor-name-inst-literal-string-empty.js | 37 ++++++++++++ ...sor-name-inst-literal-string-hex-escape.js | 37 ++++++++++++ ...r-name-inst-literal-string-single-quote.js | 37 ++++++++++++ ...name-inst-literal-string-unicode-escape.js | 37 ++++++++++++ ...sor-name-static-computed-err-evaluation.js | 40 +++++++++++++ ...or-name-static-computed-err-to-prop-key.js | 56 +++++++++++++++++++ ...r-name-static-computed-err-unresolvable.js | 38 +++++++++++++ .../class/accessor-name-static-computed.js | 41 ++++++++++++++ ...ssor-name-static-literal-numeric-binary.js | 39 +++++++++++++ ...or-name-static-literal-numeric-exponent.js | 39 +++++++++++++ ...ccessor-name-static-literal-numeric-hex.js | 39 +++++++++++++ ...-static-literal-numeric-leading-decimal.js | 39 +++++++++++++ ...me-static-literal-numeric-non-canonical.js | 39 +++++++++++++ ...essor-name-static-literal-numeric-octal.js | 39 +++++++++++++ ...cessor-name-static-literal-numeric-zero.js | 39 +++++++++++++ ...-name-static-literal-string-char-escape.js | 39 +++++++++++++ ...name-static-literal-string-double-quote.js | 39 +++++++++++++ ...cessor-name-static-literal-string-empty.js | 39 +++++++++++++ ...r-name-static-literal-string-hex-escape.js | 39 +++++++++++++ ...name-static-literal-string-single-quote.js | 39 +++++++++++++ ...me-static-literal-string-unicode-escape.js | 39 +++++++++++++ .../accessor-name-computed-err-evaluation.js | 40 +++++++++++++ .../accessor-name-computed-err-to-prop-key.js | 56 +++++++++++++++++++ ...accessor-name-computed-err-unresolvable.js | 38 +++++++++++++ .../object/accessor-name-computed.js | 40 +++++++++++++ .../accessor-name-literal-numeric-binary.js | 38 +++++++++++++ .../accessor-name-literal-numeric-exponent.js | 38 +++++++++++++ .../accessor-name-literal-numeric-hex.js | 38 +++++++++++++ ...or-name-literal-numeric-leading-decimal.js | 38 +++++++++++++ ...ssor-name-literal-numeric-non-canonical.js | 38 +++++++++++++ .../accessor-name-literal-numeric-octal.js | 38 +++++++++++++ .../accessor-name-literal-numeric-zero.js | 38 +++++++++++++ ...ccessor-name-literal-string-char-escape.js | 38 +++++++++++++ ...cessor-name-literal-string-double-quote.js | 38 +++++++++++++ .../accessor-name-literal-string-empty.js | 38 +++++++++++++ ...accessor-name-literal-string-hex-escape.js | 38 +++++++++++++ ...cessor-name-literal-string-single-quote.js | 38 +++++++++++++ ...ssor-name-literal-string-unicode-escape.js | 38 +++++++++++++ ...essor-name-inst-computed-err-evaluation.js | 38 +++++++++++++ ...ssor-name-inst-computed-err-to-prop-key.js | 54 ++++++++++++++++++ ...sor-name-inst-computed-err-unresolvable.js | 36 ++++++++++++ .../class/accessor-name-inst-computed.js | 39 +++++++++++++ ...cessor-name-inst-literal-numeric-binary.js | 37 ++++++++++++ ...ssor-name-inst-literal-numeric-exponent.js | 37 ++++++++++++ .../accessor-name-inst-literal-numeric-hex.js | 37 ++++++++++++ ...me-inst-literal-numeric-leading-decimal.js | 37 ++++++++++++ ...name-inst-literal-numeric-non-canonical.js | 37 ++++++++++++ ...ccessor-name-inst-literal-numeric-octal.js | 37 ++++++++++++ ...accessor-name-inst-literal-numeric-zero.js | 37 ++++++++++++ ...or-name-inst-literal-string-char-escape.js | 37 ++++++++++++ ...r-name-inst-literal-string-double-quote.js | 37 ++++++++++++ ...accessor-name-inst-literal-string-empty.js | 37 ++++++++++++ ...sor-name-inst-literal-string-hex-escape.js | 37 ++++++++++++ ...r-name-inst-literal-string-single-quote.js | 37 ++++++++++++ ...name-inst-literal-string-unicode-escape.js | 37 ++++++++++++ ...sor-name-static-computed-err-evaluation.js | 40 +++++++++++++ ...or-name-static-computed-err-to-prop-key.js | 56 +++++++++++++++++++ ...r-name-static-computed-err-unresolvable.js | 38 +++++++++++++ .../class/accessor-name-static-computed.js | 41 ++++++++++++++ ...ssor-name-static-literal-numeric-binary.js | 39 +++++++++++++ ...or-name-static-literal-numeric-exponent.js | 39 +++++++++++++ ...ccessor-name-static-literal-numeric-hex.js | 39 +++++++++++++ ...-static-literal-numeric-leading-decimal.js | 39 +++++++++++++ ...me-static-literal-numeric-non-canonical.js | 39 +++++++++++++ ...essor-name-static-literal-numeric-octal.js | 39 +++++++++++++ ...cessor-name-static-literal-numeric-zero.js | 39 +++++++++++++ ...-name-static-literal-string-char-escape.js | 39 +++++++++++++ ...name-static-literal-string-double-quote.js | 39 +++++++++++++ ...cessor-name-static-literal-string-empty.js | 39 +++++++++++++ ...r-name-static-literal-string-hex-escape.js | 39 +++++++++++++ ...name-static-literal-string-single-quote.js | 39 +++++++++++++ ...me-static-literal-string-unicode-escape.js | 39 +++++++++++++ 85 files changed, 3328 insertions(+) create mode 100644 test/language/expressions/class/accessor-name-inst-computed-err-evaluation.js create mode 100644 test/language/expressions/class/accessor-name-inst-computed-err-to-prop-key.js create mode 100644 test/language/expressions/class/accessor-name-inst-computed-err-unresolvable.js create mode 100644 test/language/expressions/class/accessor-name-inst-computed.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-numeric-binary.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-numeric-exponent.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-numeric-hex.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-numeric-leading-decimal.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-numeric-non-canonical.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-numeric-octal.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-numeric-zero.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-string-char-escape.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-string-double-quote.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-string-empty.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-string-hex-escape.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-string-single-quote.js create mode 100644 test/language/expressions/class/accessor-name-inst-literal-string-unicode-escape.js create mode 100644 test/language/expressions/class/accessor-name-static-computed-err-evaluation.js create mode 100644 test/language/expressions/class/accessor-name-static-computed-err-to-prop-key.js create mode 100644 test/language/expressions/class/accessor-name-static-computed-err-unresolvable.js create mode 100644 test/language/expressions/class/accessor-name-static-computed.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-numeric-binary.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-numeric-exponent.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-numeric-hex.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-numeric-leading-decimal.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-numeric-non-canonical.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-numeric-octal.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-numeric-zero.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-string-char-escape.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-string-double-quote.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-string-empty.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-string-hex-escape.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-string-single-quote.js create mode 100644 test/language/expressions/class/accessor-name-static-literal-string-unicode-escape.js create mode 100644 test/language/expressions/object/accessor-name-computed-err-evaluation.js create mode 100644 test/language/expressions/object/accessor-name-computed-err-to-prop-key.js create mode 100644 test/language/expressions/object/accessor-name-computed-err-unresolvable.js create mode 100644 test/language/expressions/object/accessor-name-computed.js create mode 100644 test/language/expressions/object/accessor-name-literal-numeric-binary.js create mode 100644 test/language/expressions/object/accessor-name-literal-numeric-exponent.js create mode 100644 test/language/expressions/object/accessor-name-literal-numeric-hex.js create mode 100644 test/language/expressions/object/accessor-name-literal-numeric-leading-decimal.js create mode 100644 test/language/expressions/object/accessor-name-literal-numeric-non-canonical.js create mode 100644 test/language/expressions/object/accessor-name-literal-numeric-octal.js create mode 100644 test/language/expressions/object/accessor-name-literal-numeric-zero.js create mode 100644 test/language/expressions/object/accessor-name-literal-string-char-escape.js create mode 100644 test/language/expressions/object/accessor-name-literal-string-double-quote.js create mode 100644 test/language/expressions/object/accessor-name-literal-string-empty.js create mode 100644 test/language/expressions/object/accessor-name-literal-string-hex-escape.js create mode 100644 test/language/expressions/object/accessor-name-literal-string-single-quote.js create mode 100644 test/language/expressions/object/accessor-name-literal-string-unicode-escape.js create mode 100644 test/language/statements/class/accessor-name-inst-computed-err-evaluation.js create mode 100644 test/language/statements/class/accessor-name-inst-computed-err-to-prop-key.js create mode 100644 test/language/statements/class/accessor-name-inst-computed-err-unresolvable.js create mode 100644 test/language/statements/class/accessor-name-inst-computed.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-numeric-binary.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-numeric-exponent.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-numeric-hex.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-numeric-leading-decimal.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-numeric-non-canonical.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-numeric-octal.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-numeric-zero.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-string-char-escape.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-string-double-quote.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-string-empty.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-string-hex-escape.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-string-single-quote.js create mode 100644 test/language/statements/class/accessor-name-inst-literal-string-unicode-escape.js create mode 100644 test/language/statements/class/accessor-name-static-computed-err-evaluation.js create mode 100644 test/language/statements/class/accessor-name-static-computed-err-to-prop-key.js create mode 100644 test/language/statements/class/accessor-name-static-computed-err-unresolvable.js create mode 100644 test/language/statements/class/accessor-name-static-computed.js create mode 100644 test/language/statements/class/accessor-name-static-literal-numeric-binary.js create mode 100644 test/language/statements/class/accessor-name-static-literal-numeric-exponent.js create mode 100644 test/language/statements/class/accessor-name-static-literal-numeric-hex.js create mode 100644 test/language/statements/class/accessor-name-static-literal-numeric-leading-decimal.js create mode 100644 test/language/statements/class/accessor-name-static-literal-numeric-non-canonical.js create mode 100644 test/language/statements/class/accessor-name-static-literal-numeric-octal.js create mode 100644 test/language/statements/class/accessor-name-static-literal-numeric-zero.js create mode 100644 test/language/statements/class/accessor-name-static-literal-string-char-escape.js create mode 100644 test/language/statements/class/accessor-name-static-literal-string-double-quote.js create mode 100644 test/language/statements/class/accessor-name-static-literal-string-empty.js create mode 100644 test/language/statements/class/accessor-name-static-literal-string-hex-escape.js create mode 100644 test/language/statements/class/accessor-name-static-literal-string-single-quote.js create mode 100644 test/language/statements/class/accessor-name-static-literal-string-unicode-escape.js diff --git a/test/language/expressions/class/accessor-name-inst-computed-err-evaluation.js b/test/language/expressions/class/accessor-name-inst-computed-err-evaluation.js new file mode 100644 index 0000000000..46ff486707 --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-computed-err-evaluation.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-evaluation.case +// - src/accessor-names/error/cls-expr-inst.template +/*--- +description: Abrupt completion when evaluating expression (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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() { + 0, class { + get [thrower()]() {} + }; +}, '`get` accessor'); + +assert.throws(Test262Error, function() { + 0, class { + set [thrower()](_) {} + }; +}, '`set` accessor'); diff --git a/test/language/expressions/class/accessor-name-inst-computed-err-to-prop-key.js b/test/language/expressions/class/accessor-name-inst-computed-err-to-prop-key.js new file mode 100644 index 0000000000..de565d806a --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-computed-err-to-prop-key.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-to-prop-key.case +// - src/accessor-names/error/cls-expr-inst.template +/*--- +description: Abrupt completion when coercing to property key value (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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() { + 0, class { + get [badKey]() {} + }; +}, '`get` accessor'); + +assert.throws(TypeError, function() { + 0, class { + set [badKey](_) {} + }; +}, '`set` accessor'); diff --git a/test/language/expressions/class/accessor-name-inst-computed-err-unresolvable.js b/test/language/expressions/class/accessor-name-inst-computed-err-unresolvable.js new file mode 100644 index 0000000000..8635d85fd4 --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-computed-err-unresolvable.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-unresolvable.case +// - src/accessor-names/error/cls-expr-inst.template +/*--- +description: Abrupt completion when resolving reference value (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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() { + 0, class { + get [test262unresolvable]() {} + }; +}, '`get` accessor'); + +assert.throws(ReferenceError, function() { + 0, class { + set [test262unresolvable](_) {} + }; +}, '`set` accessor'); diff --git a/test/language/expressions/class/accessor-name-inst-computed.js b/test/language/expressions/class/accessor-name-inst-computed.js new file mode 100644 index 0000000000..2889813250 --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-computed.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (AssignmentExpression) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-numeric-binary.js b/test/language/expressions/class/accessor-name-inst-literal-numeric-binary.js new file mode 100644 index 0000000000..e3fceb38ab --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-numeric-binary.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-binary.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in binary notation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-numeric-exponent.js b/test/language/expressions/class/accessor-name-inst-literal-numeric-exponent.js new file mode 100644 index 0000000000..c28c88e1a5 --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-numeric-exponent.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-exponent.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in exponent notation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-numeric-hex.js b/test/language/expressions/class/accessor-name-inst-literal-numeric-hex.js new file mode 100644 index 0000000000..8ca2f833be --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-numeric-hex.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-hex.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-numeric-leading-decimal.js b/test/language/expressions/class/accessor-name-inst-literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..e677bcc49e --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-numeric-leading-decimal.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-leading-decimal.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal with leading decimal point) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-numeric-non-canonical.js b/test/language/expressions/class/accessor-name-inst-literal-numeric-non-canonical.js new file mode 100644 index 0000000000..fc1bbc6977 --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-numeric-non-canonical.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-non-canonical.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal with non-canonical representation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-numeric-octal.js b/test/language/expressions/class/accessor-name-inst-literal-numeric-octal.js new file mode 100644 index 0000000000..b154e836fa --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-numeric-octal.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-octal.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in octal notation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-numeric-zero.js b/test/language/expressions/class/accessor-name-inst-literal-numeric-zero.js new file mode 100644 index 0000000000..d945c974ae --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-numeric-zero.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-zero.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal zero) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-string-char-escape.js b/test/language/expressions/class/accessor-name-inst-literal-string-char-escape.js new file mode 100644 index 0000000000..5a09b91dcc --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-string-char-escape.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-char-escape.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal containing a character escape sequence) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-string-double-quote.js b/test/language/expressions/class/accessor-name-inst-literal-string-double-quote.js new file mode 100644 index 0000000000..77a957e764 --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-string-double-quote.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-double-quote.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal using double quotes) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-string-empty.js b/test/language/expressions/class/accessor-name-inst-literal-string-empty.js new file mode 100644 index 0000000000..c882d13d83 --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-string-empty.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-empty.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal, the empty string) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + get ''() { return 'get string'; } + set ''(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype[''], 'get string'); + +C.prototype[''] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-string-hex-escape.js b/test/language/expressions/class/accessor-name-inst-literal-string-hex-escape.js new file mode 100644 index 0000000000..c6d5a86f98 --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-string-hex-escape.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-hex-escape.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-string-single-quote.js b/test/language/expressions/class/accessor-name-inst-literal-string-single-quote.js new file mode 100644 index 0000000000..47d6042496 --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-string-single-quote.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-single-quote.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal using single quotes) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-inst-literal-string-unicode-escape.js b/test/language/expressions/class/accessor-name-inst-literal-string-unicode-escape.js new file mode 100644 index 0000000000..0683e0701a --- /dev/null +++ b/test/language/expressions/class/accessor-name-inst-literal-string-unicode-escape.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-unicode-escape.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-computed-err-evaluation.js b/test/language/expressions/class/accessor-name-static-computed-err-evaluation.js new file mode 100644 index 0000000000..81f57e86af --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-computed-err-evaluation.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-evaluation.case +// - src/accessor-names/error/cls-expr-static.template +/*--- +description: Abrupt completion when evaluating expression (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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() { + 0, class { + static get [thrower()]() {} + }; +}, '`get` accessor'); + +assert.throws(Test262Error, function() { + 0, class { + static set [thrower()](_) {} + }; +}, '`set` accessor'); diff --git a/test/language/expressions/class/accessor-name-static-computed-err-to-prop-key.js b/test/language/expressions/class/accessor-name-static-computed-err-to-prop-key.js new file mode 100644 index 0000000000..166f8e5054 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-computed-err-to-prop-key.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-to-prop-key.case +// - src/accessor-names/error/cls-expr-static.template +/*--- +description: Abrupt completion when coercing to property key value (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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() { + 0, class { + static get [badKey]() {} + }; +}, '`get` accessor'); + +assert.throws(TypeError, function() { + 0, class { + static set [badKey](_) {} + }; +}, '`set` accessor'); diff --git a/test/language/expressions/class/accessor-name-static-computed-err-unresolvable.js b/test/language/expressions/class/accessor-name-static-computed-err-unresolvable.js new file mode 100644 index 0000000000..8a80209661 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-computed-err-unresolvable.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-unresolvable.case +// - src/accessor-names/error/cls-expr-static.template +/*--- +description: Abrupt completion when resolving reference value (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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() { + 0, class { + static get [test262unresolvable]() {} + }; +}, '`get` accessor'); + +assert.throws(ReferenceError, function() { + 0, class { + static set [test262unresolvable](_) {} + }; +}, '`set` accessor'); diff --git a/test/language/expressions/class/accessor-name-static-computed.js b/test/language/expressions/class/accessor-name-static-computed.js new file mode 100644 index 0000000000..ae3f2085ed --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-computed.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (AssignmentExpression) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-numeric-binary.js b/test/language/expressions/class/accessor-name-static-literal-numeric-binary.js new file mode 100644 index 0000000000..8c8e90a440 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-numeric-binary.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-binary.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal in binary notation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-numeric-exponent.js b/test/language/expressions/class/accessor-name-static-literal-numeric-exponent.js new file mode 100644 index 0000000000..ee75ad1818 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-numeric-exponent.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-exponent.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal in exponent notation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-numeric-hex.js b/test/language/expressions/class/accessor-name-static-literal-numeric-hex.js new file mode 100644 index 0000000000..70f32fdca3 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-numeric-hex.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-hex.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-numeric-leading-decimal.js b/test/language/expressions/class/accessor-name-static-literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..28e5dcd374 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-numeric-leading-decimal.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-leading-decimal.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal with leading decimal point) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-numeric-non-canonical.js b/test/language/expressions/class/accessor-name-static-literal-numeric-non-canonical.js new file mode 100644 index 0000000000..c3ecb75b77 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-numeric-non-canonical.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-non-canonical.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal with non-canonical representation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-numeric-octal.js b/test/language/expressions/class/accessor-name-static-literal-numeric-octal.js new file mode 100644 index 0000000000..b01d80b9bd --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-numeric-octal.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-octal.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal in octal notation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-numeric-zero.js b/test/language/expressions/class/accessor-name-static-literal-numeric-zero.js new file mode 100644 index 0000000000..6c3bef7f52 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-numeric-zero.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-zero.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal zero) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-string-char-escape.js b/test/language/expressions/class/accessor-name-static-literal-string-char-escape.js new file mode 100644 index 0000000000..c1fca7956b --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-string-char-escape.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-char-escape.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal containing a character escape sequence) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-string-double-quote.js b/test/language/expressions/class/accessor-name-static-literal-string-double-quote.js new file mode 100644 index 0000000000..7408da8454 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-string-double-quote.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-double-quote.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal using double quotes) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-string-empty.js b/test/language/expressions/class/accessor-name-static-literal-string-empty.js new file mode 100644 index 0000000000..510a676c44 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-string-empty.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-empty.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal, the empty string) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + static get ''() { return 'get string'; } + static set ''(param) { stringSet = param; } +}; + +assert.sameValue(C[''], 'get string'); + +C[''] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/class/accessor-name-static-literal-string-hex-escape.js b/test/language/expressions/class/accessor-name-static-literal-string-hex-escape.js new file mode 100644 index 0000000000..c853cbf255 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-string-hex-escape.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-hex-escape.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-string-single-quote.js b/test/language/expressions/class/accessor-name-static-literal-string-single-quote.js new file mode 100644 index 0000000000..ad88a05359 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-string-single-quote.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-single-quote.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal using single quotes) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/class/accessor-name-static-literal-string-unicode-escape.js b/test/language/expressions/class/accessor-name-static-literal-string-unicode-escape.js new file mode 100644 index 0000000000..39339da700 --- /dev/null +++ b/test/language/expressions/class/accessor-name-static-literal-string-unicode-escape.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-unicode-escape.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +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; + +var C = class { + 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'); diff --git a/test/language/expressions/object/accessor-name-computed-err-evaluation.js b/test/language/expressions/object/accessor-name-computed-err-evaluation.js new file mode 100644 index 0000000000..0030214a5e --- /dev/null +++ b/test/language/expressions/object/accessor-name-computed-err-evaluation.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-evaluation.case +// - src/accessor-names/error/obj.template +/*--- +description: Abrupt completion when evaluating expression (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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() { + ({ + get [thrower()]() {} + }); +}, '`get` accessor'); + +assert.throws(Test262Error, function() { + ({ + set [thrower()](_) {} + }); +}, '`set` accessor'); diff --git a/test/language/expressions/object/accessor-name-computed-err-to-prop-key.js b/test/language/expressions/object/accessor-name-computed-err-to-prop-key.js new file mode 100644 index 0000000000..4080b829cc --- /dev/null +++ b/test/language/expressions/object/accessor-name-computed-err-to-prop-key.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-to-prop-key.case +// - src/accessor-names/error/obj.template +/*--- +description: Abrupt completion when coercing to property key value (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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() { + ({ + get [badKey]() {} + }); +}, '`get` accessor'); + +assert.throws(TypeError, function() { + ({ + set [badKey](_) {} + }); +}, '`set` accessor'); diff --git a/test/language/expressions/object/accessor-name-computed-err-unresolvable.js b/test/language/expressions/object/accessor-name-computed-err-unresolvable.js new file mode 100644 index 0000000000..57254100d2 --- /dev/null +++ b/test/language/expressions/object/accessor-name-computed-err-unresolvable.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-unresolvable.case +// - src/accessor-names/error/obj.template +/*--- +description: Abrupt completion when resolving reference value (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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() { + ({ + get [test262unresolvable]() {} + }); +}, '`get` accessor'); + +assert.throws(ReferenceError, function() { + ({ + set [test262unresolvable](_) {} + }); +}, '`set` accessor'); diff --git a/test/language/expressions/object/accessor-name-computed.js b/test/language/expressions/object/accessor-name-computed.js new file mode 100644 index 0000000000..e07d6d0600 --- /dev/null +++ b/test/language/expressions/object/accessor-name-computed.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (AssignmentExpression) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get [[_ = 'str' + 'ing']]() { return 'get string'; }, + set [[_ = 'str' + 'ing']](param) { stringSet = param; } +}; + +assert.sameValue(obj['string'], 'get string'); + +obj['string'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-numeric-binary.js b/test/language/expressions/object/accessor-name-literal-numeric-binary.js new file mode 100644 index 0000000000..8a982012bc --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-numeric-binary.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-binary.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal in binary notation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get [0b10]() { return 'get string'; }, + set [0b10](param) { stringSet = param; } +}; + +assert.sameValue(obj['2'], 'get string'); + +obj['2'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-numeric-exponent.js b/test/language/expressions/object/accessor-name-literal-numeric-exponent.js new file mode 100644 index 0000000000..4699130bb1 --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-numeric-exponent.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-exponent.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal in exponent notation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get [1E+9]() { return 'get string'; }, + set [1E+9](param) { stringSet = param; } +}; + +assert.sameValue(obj['1000000000'], 'get string'); + +obj['1000000000'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-numeric-hex.js b/test/language/expressions/object/accessor-name-literal-numeric-hex.js new file mode 100644 index 0000000000..f347797191 --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-numeric-hex.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-hex.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get [0x10]() { return 'get string'; }, + set [0x10](param) { stringSet = param; } +}; + +assert.sameValue(obj['16'], 'get string'); + +obj['16'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-numeric-leading-decimal.js b/test/language/expressions/object/accessor-name-literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..aa9eee9f5c --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-numeric-leading-decimal.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-leading-decimal.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal with leading decimal point) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get [.1]() { return 'get string'; }, + set [.1](param) { stringSet = param; } +}; + +assert.sameValue(obj['0.1'], 'get string'); + +obj['0.1'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-numeric-non-canonical.js b/test/language/expressions/object/accessor-name-literal-numeric-non-canonical.js new file mode 100644 index 0000000000..fca4bf2911 --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-numeric-non-canonical.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-non-canonical.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal with non-canonical representation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get [0.0000001]() { return 'get string'; }, + set [0.0000001](param) { stringSet = param; } +}; + +assert.sameValue(obj['1e-7'], 'get string'); + +obj['1e-7'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-numeric-octal.js b/test/language/expressions/object/accessor-name-literal-numeric-octal.js new file mode 100644 index 0000000000..c6d7eaec26 --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-numeric-octal.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-octal.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal in octal notation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get [0o10]() { return 'get string'; }, + set [0o10](param) { stringSet = param; } +}; + +assert.sameValue(obj['8'], 'get string'); + +obj['8'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-numeric-zero.js b/test/language/expressions/object/accessor-name-literal-numeric-zero.js new file mode 100644 index 0000000000..49275e7379 --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-numeric-zero.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-zero.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal zero) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get [0]() { return 'get string'; }, + set [0](param) { stringSet = param; } +}; + +assert.sameValue(obj['0'], 'get string'); + +obj['0'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-string-char-escape.js b/test/language/expressions/object/accessor-name-literal-string-char-escape.js new file mode 100644 index 0000000000..9321f4909c --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-string-char-escape.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-char-escape.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal containing a character escape sequence) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get ['character\tescape']() { return 'get string'; }, + set ['character\tescape'](param) { stringSet = param; } +}; + +assert.sameValue(obj['character escape'], 'get string'); + +obj['character escape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-string-double-quote.js b/test/language/expressions/object/accessor-name-literal-string-double-quote.js new file mode 100644 index 0000000000..e22fa09277 --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-string-double-quote.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-double-quote.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal using double quotes) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get ["doubleQuote"]() { return 'get string'; }, + set ["doubleQuote"](param) { stringSet = param; } +}; + +assert.sameValue(obj["doubleQuote"], 'get string'); + +obj["doubleQuote"] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-string-empty.js b/test/language/expressions/object/accessor-name-literal-string-empty.js new file mode 100644 index 0000000000..bb49a10c6c --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-string-empty.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-empty.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal, the empty string) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get ['']() { return 'get string'; }, + set [''](param) { stringSet = param; } +}; + +assert.sameValue(obj[''], 'get string'); + +obj[''] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-string-hex-escape.js b/test/language/expressions/object/accessor-name-literal-string-hex-escape.js new file mode 100644 index 0000000000..7020bf90b7 --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-string-hex-escape.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-hex-escape.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get ['hex\x45scape']() { return 'get string'; }, + set ['hex\x45scape'](param) { stringSet = param; } +}; + +assert.sameValue(obj['hexEscape'], 'get string'); + +obj['hexEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-string-single-quote.js b/test/language/expressions/object/accessor-name-literal-string-single-quote.js new file mode 100644 index 0000000000..1671d46d6d --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-string-single-quote.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-single-quote.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal using single quotes) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get ['singleQuote']() { return 'get string'; }, + set ['singleQuote'](param) { stringSet = param; } +}; + +assert.sameValue(obj['singleQuote'], 'get string'); + +obj['singleQuote'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/expressions/object/accessor-name-literal-string-unicode-escape.js b/test/language/expressions/object/accessor-name-literal-string-unicode-escape.js new file mode 100644 index 0000000000..8c4582927b --- /dev/null +++ b/test/language/expressions/object/accessor-name-literal-string-unicode-escape.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-unicode-escape.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 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; +var obj = { + get ['unicod\u{000065}Escape']() { return 'get string'; }, + set ['unicod\u{000065}Escape'](param) { stringSet = param; } +}; + +assert.sameValue(obj['unicodeEscape'], 'get string'); + +obj['unicodeEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); diff --git a/test/language/statements/class/accessor-name-inst-computed-err-evaluation.js b/test/language/statements/class/accessor-name-inst-computed-err-evaluation.js new file mode 100644 index 0000000000..31aa7e3e48 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-computed-err-evaluation.js @@ -0,0 +1,38 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-computed-err-to-prop-key.js b/test/language/statements/class/accessor-name-inst-computed-err-to-prop-key.js new file mode 100644 index 0000000000..b09ad68e5f --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-computed-err-to-prop-key.js @@ -0,0 +1,54 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-computed-err-unresolvable.js b/test/language/statements/class/accessor-name-inst-computed-err-unresolvable.js new file mode 100644 index 0000000000..8986366179 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-computed-err-unresolvable.js @@ -0,0 +1,36 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-computed.js b/test/language/statements/class/accessor-name-inst-computed.js new file mode 100644 index 0000000000..5ed6d77fe0 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-computed.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-numeric-binary.js b/test/language/statements/class/accessor-name-inst-literal-numeric-binary.js new file mode 100644 index 0000000000..0295deecec --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-numeric-binary.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-numeric-exponent.js b/test/language/statements/class/accessor-name-inst-literal-numeric-exponent.js new file mode 100644 index 0000000000..2e1198f108 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-numeric-exponent.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-numeric-hex.js b/test/language/statements/class/accessor-name-inst-literal-numeric-hex.js new file mode 100644 index 0000000000..c1a383d932 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-numeric-hex.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-numeric-leading-decimal.js b/test/language/statements/class/accessor-name-inst-literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..18486f2248 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-numeric-leading-decimal.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-numeric-non-canonical.js b/test/language/statements/class/accessor-name-inst-literal-numeric-non-canonical.js new file mode 100644 index 0000000000..d1ddf2ddcd --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-numeric-non-canonical.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-numeric-octal.js b/test/language/statements/class/accessor-name-inst-literal-numeric-octal.js new file mode 100644 index 0000000000..a034cec9b8 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-numeric-octal.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-numeric-zero.js b/test/language/statements/class/accessor-name-inst-literal-numeric-zero.js new file mode 100644 index 0000000000..5cbda34bf0 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-numeric-zero.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-string-char-escape.js b/test/language/statements/class/accessor-name-inst-literal-string-char-escape.js new file mode 100644 index 0000000000..9534f1b77a --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-string-char-escape.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-string-double-quote.js b/test/language/statements/class/accessor-name-inst-literal-string-double-quote.js new file mode 100644 index 0000000000..6bf28077b5 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-string-double-quote.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-string-empty.js b/test/language/statements/class/accessor-name-inst-literal-string-empty.js new file mode 100644 index 0000000000..7cec7acda9 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-string-empty.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-string-hex-escape.js b/test/language/statements/class/accessor-name-inst-literal-string-hex-escape.js new file mode 100644 index 0000000000..8e78cb4168 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-string-hex-escape.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-string-single-quote.js b/test/language/statements/class/accessor-name-inst-literal-string-single-quote.js new file mode 100644 index 0000000000..a3cf04c997 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-string-single-quote.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-inst-literal-string-unicode-escape.js b/test/language/statements/class/accessor-name-inst-literal-string-unicode-escape.js new file mode 100644 index 0000000000..bb52a82378 --- /dev/null +++ b/test/language/statements/class/accessor-name-inst-literal-string-unicode-escape.js @@ -0,0 +1,37 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-computed-err-evaluation.js b/test/language/statements/class/accessor-name-static-computed-err-evaluation.js new file mode 100644 index 0000000000..08dcb2433b --- /dev/null +++ b/test/language/statements/class/accessor-name-static-computed-err-evaluation.js @@ -0,0 +1,40 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-computed-err-to-prop-key.js b/test/language/statements/class/accessor-name-static-computed-err-to-prop-key.js new file mode 100644 index 0000000000..9183c05f63 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-computed-err-to-prop-key.js @@ -0,0 +1,56 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-computed-err-unresolvable.js b/test/language/statements/class/accessor-name-static-computed-err-unresolvable.js new file mode 100644 index 0000000000..5ef84b7261 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-computed-err-unresolvable.js @@ -0,0 +1,38 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-computed.js b/test/language/statements/class/accessor-name-static-computed.js new file mode 100644 index 0000000000..c6af00bc74 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-computed.js @@ -0,0 +1,41 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-numeric-binary.js b/test/language/statements/class/accessor-name-static-literal-numeric-binary.js new file mode 100644 index 0000000000..aaf5df8f26 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-numeric-binary.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-numeric-exponent.js b/test/language/statements/class/accessor-name-static-literal-numeric-exponent.js new file mode 100644 index 0000000000..b2dff5e0b9 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-numeric-exponent.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-numeric-hex.js b/test/language/statements/class/accessor-name-static-literal-numeric-hex.js new file mode 100644 index 0000000000..70e1b8c852 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-numeric-hex.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-numeric-leading-decimal.js b/test/language/statements/class/accessor-name-static-literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..e0444ce8b5 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-numeric-leading-decimal.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-numeric-non-canonical.js b/test/language/statements/class/accessor-name-static-literal-numeric-non-canonical.js new file mode 100644 index 0000000000..cafc2a70db --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-numeric-non-canonical.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-numeric-octal.js b/test/language/statements/class/accessor-name-static-literal-numeric-octal.js new file mode 100644 index 0000000000..53ff7d7a4b --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-numeric-octal.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-numeric-zero.js b/test/language/statements/class/accessor-name-static-literal-numeric-zero.js new file mode 100644 index 0000000000..1cea0065bb --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-numeric-zero.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-string-char-escape.js b/test/language/statements/class/accessor-name-static-literal-string-char-escape.js new file mode 100644 index 0000000000..81c952706f --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-string-char-escape.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-string-double-quote.js b/test/language/statements/class/accessor-name-static-literal-string-double-quote.js new file mode 100644 index 0000000000..5fdc5cc3c1 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-string-double-quote.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-string-empty.js b/test/language/statements/class/accessor-name-static-literal-string-empty.js new file mode 100644 index 0000000000..626dd6b2a1 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-string-empty.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-string-hex-escape.js b/test/language/statements/class/accessor-name-static-literal-string-hex-escape.js new file mode 100644 index 0000000000..cbc3b5e50e --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-string-hex-escape.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-string-single-quote.js b/test/language/statements/class/accessor-name-static-literal-string-single-quote.js new file mode 100644 index 0000000000..e916df4c78 --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-string-single-quote.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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'); diff --git a/test/language/statements/class/accessor-name-static-literal-string-unicode-escape.js b/test/language/statements/class/accessor-name-static-literal-string-unicode-escape.js new file mode 100644 index 0000000000..4702d3739f --- /dev/null +++ b/test/language/statements/class/accessor-name-static-literal-string-unicode-escape.js @@ -0,0 +1,39 @@ +// 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 +es6id: 14.5.14 +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');