mirror of
https://github.com/tc39/test262.git
synced 2025-07-28 16:34:27 +02:00
Merge pull request #1344 from leobalter/class-fields-same-name
Class fields with the same name
This commit is contained in:
commit
77c70a514d
17
src/class-fields/class-evaluation-error/cls-decl.template
Normal file
17
src/class-fields/class-evaluation-error/cls-decl.template
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
path: language/statements/class/fields-evaluation-error-
|
||||||
|
name: field definitions in a class declaration
|
||||||
|
features: [class-fields]
|
||||||
|
esid: sec-runtime-semantics-classdefinitionevaluation
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function evaluate() {
|
||||||
|
class C {
|
||||||
|
/*{ fields }*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(/*{ error }*/, evaluate);
|
17
src/class-fields/class-evaluation-error/cls-expr.template
Normal file
17
src/class-fields/class-evaluation-error/cls-expr.template
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
path: language/expressions/class/fields-evaluation-error-
|
||||||
|
name: field definitions in a class expression
|
||||||
|
features: [class-fields]
|
||||||
|
esid: sec-runtime-semantics-classdefinitionevaluation
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function evaluate() {
|
||||||
|
var C = class {
|
||||||
|
/*{ fields }*/
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(/*{ error }*/, evaluate);
|
54
src/class-fields/computed-name-referenceerror.case
Normal file
54
src/class-fields/computed-name-referenceerror.case
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: ReferenceError evaluating a computed property name
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: class-evaluation-error
|
||||||
|
features: [computed-property-names]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
function fn() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
[noRef] = fn();
|
||||||
|
//- error
|
||||||
|
ReferenceError
|
56
src/class-fields/computed-name-toprimitive-err.case
Normal file
56
src/class-fields/computed-name-toprimitive-err.case
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Custom error evaluating a computed property name
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: class-evaluation-error
|
||||||
|
features: [computed-property-names, Symbol.toPrimitive]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var obj = {
|
||||||
|
[Symbol.toPrimitive]: function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
[obj]
|
||||||
|
//- error
|
||||||
|
Test262Error
|
@ -0,0 +1,55 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Custom error evaluating a computed property name
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: class-evaluation-error
|
||||||
|
features: [computed-property-names, Symbol.toPrimitive]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var obj = {
|
||||||
|
[Symbol.toPrimitive]: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
[obj] = refErrorIfEvaluated;
|
||||||
|
//- error
|
||||||
|
TypeError
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Custom error evaluating a computed property name
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: class-evaluation-error
|
||||||
|
features: [computed-property-names, Symbol.toPrimitive]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var obj = {
|
||||||
|
[Symbol.toPrimitive]: 42
|
||||||
|
};
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
[obj] = refErrorIfEvaluated;
|
||||||
|
//- error
|
||||||
|
TypeError
|
103
src/class-fields/computed-name-toprimitive-symbol.case
Normal file
103
src/class-fields/computed-name-toprimitive-symbol.case
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: ToPrimitive evaluation in the ComputedPropertyName
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: default
|
||||||
|
features: [computed-property-names, Symbol.toPrimitive, Symbol]
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var s1 = Symbol();
|
||||||
|
var s2 = Symbol();
|
||||||
|
var s3 = Symbol();
|
||||||
|
var err = function() { throw new Test262Error(); };
|
||||||
|
var obj1 = {
|
||||||
|
[Symbol.toPrimitive]: function() { return s1; },
|
||||||
|
toString: err,
|
||||||
|
valueOf: err
|
||||||
|
};
|
||||||
|
|
||||||
|
var obj2 = {
|
||||||
|
toString: function() { return s2; },
|
||||||
|
valueOf: err
|
||||||
|
};
|
||||||
|
|
||||||
|
var obj3 = {
|
||||||
|
toString: undefined,
|
||||||
|
valueOf: function() { return s3; }
|
||||||
|
};
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
[obj1] = 42;
|
||||||
|
[obj2] = 43;
|
||||||
|
[obj3] = 44;
|
||||||
|
//- assertions
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, s1), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C, s1), false);
|
||||||
|
|
||||||
|
verifyProperty(c, s1, {
|
||||||
|
value: 42,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, s2), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C, s2), false);
|
||||||
|
|
||||||
|
verifyProperty(c, s2, {
|
||||||
|
value: 43,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, s3), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C, s3), false);
|
||||||
|
|
||||||
|
verifyProperty(c, s3, {
|
||||||
|
value: 44,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
100
src/class-fields/computed-name-toprimitive.case
Normal file
100
src/class-fields/computed-name-toprimitive.case
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: ToPrimitive evaluation in the ComputedPropertyName
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: default
|
||||||
|
features: [computed-property-names, Symbol.toPrimitive]
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var err = function() { throw new Test262Error(); };
|
||||||
|
var obj1 = {
|
||||||
|
[Symbol.toPrimitive]: function() { return "d"; },
|
||||||
|
toString: err,
|
||||||
|
valueOf: err
|
||||||
|
};
|
||||||
|
|
||||||
|
var obj2 = {
|
||||||
|
toString: function() { return "e"; },
|
||||||
|
valueOf: err
|
||||||
|
};
|
||||||
|
|
||||||
|
var obj3 = {
|
||||||
|
toString: undefined,
|
||||||
|
valueOf: function() { return "f"; }
|
||||||
|
};
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
[obj1] = 42;
|
||||||
|
[obj2] = 43;
|
||||||
|
[obj3] = 44;
|
||||||
|
//- assertions
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C, "d"), false);
|
||||||
|
|
||||||
|
verifyProperty(c, "d", {
|
||||||
|
value: 42,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "e"), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C, "e"), false);
|
||||||
|
|
||||||
|
verifyProperty(c, "e", {
|
||||||
|
value: 43,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "f"), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C, "f"), false);
|
||||||
|
|
||||||
|
verifyProperty(c, "f", {
|
||||||
|
value: 44,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
57
src/class-fields/computed-name-tostring-err.case
Normal file
57
src/class-fields/computed-name-tostring-err.case
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Custom error evaluating a computed property name
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: class-evaluation-error
|
||||||
|
features: [computed-property-names]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var obj = {
|
||||||
|
toString: function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
[obj]
|
||||||
|
//- error
|
||||||
|
Test262Error
|
||||||
|
|
57
src/class-fields/computed-name-valueof-err.case
Normal file
57
src/class-fields/computed-name-valueof-err.case
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Custom error evaluating a computed property name
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: class-evaluation-error
|
||||||
|
features: [computed-property-names]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var obj = {
|
||||||
|
toString: undefined,
|
||||||
|
valueOf: function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
[obj]
|
||||||
|
//- error
|
||||||
|
Test262Error
|
@ -13,7 +13,7 @@ info: |
|
|||||||
|
|
||||||
ClassElementName:
|
ClassElementName:
|
||||||
PropertyName
|
PropertyName
|
||||||
template: default
|
template: productions
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
features: [computed-property-names]
|
features: [computed-property-names]
|
||||||
---*/
|
---*/
|
||||||
|
@ -13,7 +13,7 @@ info: |
|
|||||||
|
|
||||||
ClassElementName:
|
ClassElementName:
|
||||||
PropertyName
|
PropertyName
|
||||||
template: default
|
template: productions
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
features: [Symbol, computed-property-names]
|
features: [Symbol, computed-property-names]
|
||||||
---*/
|
---*/
|
||||||
|
29
src/class-fields/ctor-called-after-fields-init.case
Normal file
29
src/class-fields/ctor-called-after-fields-init.case
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: The constructor method is called after the fields are initalized
|
||||||
|
info: |
|
||||||
|
[[Construct]] ( argumentsList, newTarget)
|
||||||
|
|
||||||
|
8. If kind is "base", then
|
||||||
|
a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
|
||||||
|
b. Let result be InitializeInstanceFields(thisArgument, F).
|
||||||
|
...
|
||||||
|
...
|
||||||
|
11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||||
|
...
|
||||||
|
template: default
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var ctor;
|
||||||
|
//- fields
|
||||||
|
constructor() {
|
||||||
|
ctor = this.foo;
|
||||||
|
}
|
||||||
|
foo = 42;
|
||||||
|
//- assertions
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
|
assert.sameValue(ctor, 42);
|
15
src/class-fields/default/cls-decl.template
Normal file
15
src/class-fields/default/cls-decl.template
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
path: language/statements/class/fields-
|
||||||
|
name: field definitions in a class declaration
|
||||||
|
features: [class-fields]
|
||||||
|
esid: prod-FieldDefinition
|
||||||
|
---*/
|
||||||
|
|
||||||
|
class C {
|
||||||
|
/*{ fields }*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
15
src/class-fields/default/cls-expr.template
Normal file
15
src/class-fields/default/cls-expr.template
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
path: language/expressions/class/fields-
|
||||||
|
name: field definitions in a class expression
|
||||||
|
features: [class-fields]
|
||||||
|
esid: prod-FieldDefinition
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
/*{ fields }*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
path: language/statements/class/fields-new-no-sc-line-gen-
|
|
||||||
name: ASI prevents a following generator method
|
|
||||||
features: [class-fields, generators]
|
|
||||||
negative:
|
|
||||||
type: SyntaxError
|
|
||||||
phase: early
|
|
||||||
---*/
|
|
||||||
|
|
||||||
class C {
|
|
||||||
/*{ fields }*/
|
|
||||||
*m() { return 42; }
|
|
||||||
}
|
|
32
src/class-fields/init-err-evaluation.case
Normal file
32
src/class-fields/init-err-evaluation.case
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Return abrupt completion evaluating the field initializer
|
||||||
|
info: |
|
||||||
|
[[Construct]] ( argumentsList, newTarget)
|
||||||
|
|
||||||
|
8. If kind is "base", then
|
||||||
|
a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
|
||||||
|
b. Let result be InitializeInstanceFields(thisArgument, F).
|
||||||
|
...
|
||||||
|
...
|
||||||
|
11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||||
|
...
|
||||||
|
template: default
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x = 0;
|
||||||
|
function fn1() { x += 1; }
|
||||||
|
function fn2() { throw new Test262Error(); }
|
||||||
|
//- fields
|
||||||
|
x = fn1();
|
||||||
|
y = fn2();
|
||||||
|
z = fn1();
|
||||||
|
//- assertions
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
new C();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(x, 1);
|
45
src/class-fields/init-value-defined-after-class.case
Normal file
45
src/class-fields/init-value-defined-after-class.case
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: The initializer value is defined after the class evaluation
|
||||||
|
info: |
|
||||||
|
[[Construct]] ( argumentsList, newTarget)
|
||||||
|
|
||||||
|
8. If kind is "base", then
|
||||||
|
a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
|
||||||
|
b. Let result be InitializeInstanceFields(thisArgument, F).
|
||||||
|
...
|
||||||
|
...
|
||||||
|
11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||||
|
...
|
||||||
|
template: default
|
||||||
|
features: [computed-property-names]
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x = false;
|
||||||
|
//- fields
|
||||||
|
[x] = x;
|
||||||
|
//- assertions
|
||||||
|
var c1 = new C();
|
||||||
|
|
||||||
|
x = true;
|
||||||
|
var c2 = new C();
|
||||||
|
|
||||||
|
verifyProperty(c1, "false", {
|
||||||
|
value: false,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
writable: true,
|
||||||
|
});
|
||||||
|
verifyProperty(c2, "false", {
|
||||||
|
value: true,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
writable: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(c1.hasOwnProperty("true"), false);
|
||||||
|
assert.sameValue(c2.hasOwnProperty("true"), false);
|
81
src/class-fields/init-value-incremental.case
Normal file
81
src/class-fields/init-value-incremental.case
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: The initializer value is defined during the class instatiation
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
...
|
||||||
|
d. Append to fieldRecords the elements of fields.
|
||||||
|
...
|
||||||
|
33. Let result be InitializeStaticFields(F).
|
||||||
|
...
|
||||||
|
|
||||||
|
[[Construct]] ( argumentsList, newTarget)
|
||||||
|
|
||||||
|
8. If kind is "base", then
|
||||||
|
a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
|
||||||
|
b. Let result be InitializeInstanceFields(thisArgument, F).
|
||||||
|
...
|
||||||
|
...
|
||||||
|
11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
|
||||||
|
...
|
||||||
|
template: default
|
||||||
|
features: [computed-property-names]
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x = 0;
|
||||||
|
//- fields
|
||||||
|
static [x++] = x++;
|
||||||
|
[x++] = x++;
|
||||||
|
static [x++] = x++;
|
||||||
|
[x++] = x++;
|
||||||
|
//- assertions
|
||||||
|
var c1 = new C();
|
||||||
|
var c2 = new C();
|
||||||
|
|
||||||
|
verifyProperty(C, "0", {
|
||||||
|
value: 4,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
writable: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(C, "2", {
|
||||||
|
value: 5,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
writable: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(c1, "1", {
|
||||||
|
value: 6,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
writable: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(c1, "3", {
|
||||||
|
value: 7,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
writable: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(c2, "1", {
|
||||||
|
value: 8,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
writable: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(c2, "3", {
|
||||||
|
value: 9,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
writable: true,
|
||||||
|
});
|
@ -13,7 +13,7 @@ info: |
|
|||||||
|
|
||||||
ClassElementName:
|
ClassElementName:
|
||||||
PropertyName
|
PropertyName
|
||||||
template: default
|
template: productions
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ info: |
|
|||||||
|
|
||||||
PrivateName:
|
PrivateName:
|
||||||
#IdentifierName
|
#IdentifierName
|
||||||
template: default
|
template: productions
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
//- fields
|
//- fields
|
||||||
|
52
src/class-fields/redeclaration-symbol.case
Normal file
52
src/class-fields/redeclaration-symbol.case
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Redeclaration of public fields with the same name
|
||||||
|
info: |
|
||||||
|
2.13.2 Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
30. Set the value of F's [[Fields]] internal slot to fieldRecords.
|
||||||
|
...
|
||||||
|
|
||||||
|
2.14 [[Construct]] ( argumentsList, newTarget)
|
||||||
|
|
||||||
|
...
|
||||||
|
8. If kind is "base", then
|
||||||
|
...
|
||||||
|
b. Let result be InitializeInstanceFields(thisArgument, F).
|
||||||
|
...
|
||||||
|
|
||||||
|
2.9 InitializeInstanceFields ( O, constructor )
|
||||||
|
|
||||||
|
3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
|
||||||
|
4. For each item fieldRecord in order from fieldRecords,
|
||||||
|
a. If fieldRecord.[[static]] is false, then
|
||||||
|
i. Perform ? DefineField(O, fieldRecord).
|
||||||
|
|
||||||
|
template: default
|
||||||
|
includes: [propertyHelper.js, compareArray.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x = [];
|
||||||
|
var y = Symbol();
|
||||||
|
//- fields
|
||||||
|
[y] = (x.push("a"), "old_value");
|
||||||
|
[y] = (x.push("b"), "same_value");
|
||||||
|
[y] = (x.push("c"), "same_value");
|
||||||
|
//- assertions
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C, y), false);
|
||||||
|
|
||||||
|
verifyProperty(c, y, {
|
||||||
|
value: "same_value",
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(compareArray(x, ["a", "b", "c"]));
|
52
src/class-fields/redeclaration.case
Normal file
52
src/class-fields/redeclaration.case
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Redeclaration of public fields with the same name
|
||||||
|
info: |
|
||||||
|
2.13.2 Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
30. Set the value of F's [[Fields]] internal slot to fieldRecords.
|
||||||
|
...
|
||||||
|
|
||||||
|
2.14 [[Construct]] ( argumentsList, newTarget)
|
||||||
|
|
||||||
|
...
|
||||||
|
8. If kind is "base", then
|
||||||
|
...
|
||||||
|
b. Let result be InitializeInstanceFields(thisArgument, F).
|
||||||
|
...
|
||||||
|
|
||||||
|
2.9 InitializeInstanceFields ( O, constructor )
|
||||||
|
|
||||||
|
3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
|
||||||
|
4. For each item fieldRecord in order from fieldRecords,
|
||||||
|
a. If fieldRecord.[[static]] is false, then
|
||||||
|
i. Perform ? DefineField(O, fieldRecord).
|
||||||
|
|
||||||
|
template: default
|
||||||
|
includes: [propertyHelper.js, compareArray.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x = [];
|
||||||
|
//- fields
|
||||||
|
y = (x.push("a"), "old_value");
|
||||||
|
["y"] = (x.push("b"), "another_value");
|
||||||
|
"y" = (x.push("c"), "same_value");
|
||||||
|
y = (x.push("d"), "same_value");
|
||||||
|
//- assertions
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C, "y"), false);
|
||||||
|
|
||||||
|
verifyProperty(c, "y", {
|
||||||
|
value: "same_value",
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(compareArray(x, ["a", "b", "c", "d"]));
|
102
src/class-fields/static-computed-name-toprimitive-symbol.case
Normal file
102
src/class-fields/static-computed-name-toprimitive-symbol.case
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: ToPrimitive evaluation in the ComputedPropertyName
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: default
|
||||||
|
features: [computed-property-names, Symbol.toPrimitive, Symbol]
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var s1 = Symbol();
|
||||||
|
var s2 = Symbol();
|
||||||
|
var s3 = Symbol();
|
||||||
|
var err = function() { throw new Test262Error(); };
|
||||||
|
var obj1 = {
|
||||||
|
[Symbol.toPrimitive]: function() { return s1; },
|
||||||
|
toString: err,
|
||||||
|
valueOf: err
|
||||||
|
};
|
||||||
|
|
||||||
|
var obj2 = {
|
||||||
|
toString: function() { return s2; },
|
||||||
|
valueOf: err
|
||||||
|
};
|
||||||
|
|
||||||
|
var obj3 = {
|
||||||
|
toString: undefined,
|
||||||
|
valueOf: function() { return s3; }
|
||||||
|
};
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
static [obj1] = 42;
|
||||||
|
static [obj2] = 43;
|
||||||
|
static [obj3] = 44;
|
||||||
|
//- assertions
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, s1), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, s2), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, s3), false);
|
||||||
|
|
||||||
|
verifyProperty(C, s1, {
|
||||||
|
value: 42,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(C, s2, {
|
||||||
|
value: 43,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(C, s3, {
|
||||||
|
value: 44,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(c, s1), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(c, s2), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(c, s3), false);
|
99
src/class-fields/static-computed-name-toprimitive.case
Normal file
99
src/class-fields/static-computed-name-toprimitive.case
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: ToPrimitive evaluation in the ComputedPropertyName
|
||||||
|
info: |
|
||||||
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
27. For each ClassElement e in order from elements
|
||||||
|
a. If IsStatic of me is false, then
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
|
||||||
|
b. Else,
|
||||||
|
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
|
||||||
|
c. If fields is an abrupt completion, then
|
||||||
|
i. Set the running execution context's LexicalEnvironment to lex.
|
||||||
|
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
|
||||||
|
iii. Return Completion(status).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: ClassElementEvaluation
|
||||||
|
|
||||||
|
ClassElement: static FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object.
|
||||||
|
|
||||||
|
ClassElement: FieldDefinition;
|
||||||
|
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
|
||||||
|
|
||||||
|
Runtime Semantics: ClassFieldDefinitionEvaluation
|
||||||
|
With parameters isStatic and homeObject.
|
||||||
|
|
||||||
|
1. Let fieldName be the result of evaluating ClassElementName.
|
||||||
|
2. ReturnIfAbrupt(fieldName).
|
||||||
|
...
|
||||||
|
|
||||||
|
Runtime Semantics: Evaluation
|
||||||
|
ComputedPropertyName: [ AssignmentExpression ]
|
||||||
|
|
||||||
|
1. Let exprValue be the result of evaluating AssignmentExpression.
|
||||||
|
2. Let propName be ? GetValue(exprValue).
|
||||||
|
3. Return ? ToPropertyKey(propName).
|
||||||
|
template: default
|
||||||
|
features: [computed-property-names, Symbol.toPrimitive]
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var err = function() { throw new Test262Error(); };
|
||||||
|
var obj1 = {
|
||||||
|
[Symbol.toPrimitive]: function() { return "d"; },
|
||||||
|
toString: err,
|
||||||
|
valueOf: err
|
||||||
|
};
|
||||||
|
|
||||||
|
var obj2 = {
|
||||||
|
toString: function() { return "e"; },
|
||||||
|
valueOf: err
|
||||||
|
};
|
||||||
|
|
||||||
|
var obj3 = {
|
||||||
|
toString: undefined,
|
||||||
|
valueOf: function() { return "f"; }
|
||||||
|
};
|
||||||
|
|
||||||
|
//- fields
|
||||||
|
static [obj1] = 42;
|
||||||
|
static [obj2] = 43;
|
||||||
|
static [obj3] = 44;
|
||||||
|
//- assertions
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "e"), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "f"), false);
|
||||||
|
|
||||||
|
verifyProperty(C, "d", {
|
||||||
|
value: 42,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(C, "e", {
|
||||||
|
value: 43,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(C, "f", {
|
||||||
|
value: 44,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(c, "d"), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(c, "e"), false);
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(c, "f"), false);
|
@ -14,7 +14,7 @@ info: |
|
|||||||
|
|
||||||
ClassElementName:
|
ClassElementName:
|
||||||
PropertyName
|
PropertyName
|
||||||
template: default
|
template: productions
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
features: [computed-property-names]
|
features: [computed-property-names]
|
||||||
---*/
|
---*/
|
||||||
|
@ -13,7 +13,7 @@ info: |
|
|||||||
|
|
||||||
ClassElementName:
|
ClassElementName:
|
||||||
PropertyName
|
PropertyName
|
||||||
template: default
|
template: productions
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
features: [Symbol, computed-property-names]
|
features: [Symbol, computed-property-names]
|
||||||
---*/
|
---*/
|
||||||
@ -23,12 +23,12 @@ var x = Symbol();
|
|||||||
var y = Symbol();
|
var y = Symbol();
|
||||||
|
|
||||||
//- fields
|
//- fields
|
||||||
[x]; [y] = 42
|
static [x]; static [y] = 42
|
||||||
//- assertions
|
//- assertions
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, x), false);
|
||||||
|
|
||||||
verifyProperty(c, x, {
|
verifyProperty(C, x, {
|
||||||
value: undefined,
|
value: undefined,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
@ -36,9 +36,9 @@ verifyProperty(c, x, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, y), false);
|
||||||
|
|
||||||
verifyProperty(c, y, {
|
verifyProperty(C, y, {
|
||||||
value: 42,
|
value: 42,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
|
@ -13,7 +13,7 @@ info: |
|
|||||||
|
|
||||||
ClassElementName:
|
ClassElementName:
|
||||||
PropertyName
|
PropertyName
|
||||||
template: default
|
template: productions
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ info: |
|
|||||||
|
|
||||||
PrivateName:
|
PrivateName:
|
||||||
#IdentifierName
|
#IdentifierName
|
||||||
template: default
|
template: productions
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
//- fields
|
//- fields
|
||||||
|
47
src/class-fields/static-redeclaration-symbol.case
Normal file
47
src/class-fields/static-redeclaration-symbol.case
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Redeclaration of public static fields with the same name
|
||||||
|
info: |
|
||||||
|
2.13.2 Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
30. Set the value of F's [[Fields]] internal slot to fieldRecords.
|
||||||
|
...
|
||||||
|
33. Let result be InitializeStaticFields(F).
|
||||||
|
|
||||||
|
InitializeStaticFields(F)
|
||||||
|
|
||||||
|
3. Let fieldRecords be the value of F's [[Fields]] internal slot.
|
||||||
|
4. For each item fieldRecord in order from fieldRecords,
|
||||||
|
a. If fieldRecord.[[static]] is true, then
|
||||||
|
i. Perform ? DefineField(F, fieldRecord).
|
||||||
|
|
||||||
|
template: default
|
||||||
|
includes: [propertyHelper.js, compareArray.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x = [];
|
||||||
|
var y = Symbol();
|
||||||
|
//- fields
|
||||||
|
static [y] = (x.push("a"), "old_value");
|
||||||
|
static [y] = (x.push("b"), "same_value");
|
||||||
|
static [y] = (x.push("c"), "same_value");
|
||||||
|
//- assertions
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
||||||
|
|
||||||
|
verifyProperty(C, y, {
|
||||||
|
value: "same_value",
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(compareArray(x, ["a", "b", "c"]));
|
||||||
|
|
||||||
|
var c = new C();
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(c, y), false);
|
||||||
|
|
||||||
|
assert(compareArray(x, ["a", "b", "c"]), "static fields are not redefined on class instatiation");
|
47
src/class-fields/static-redeclaration.case
Normal file
47
src/class-fields/static-redeclaration.case
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Redeclaration of public static fields with the same name
|
||||||
|
info: |
|
||||||
|
2.13.2 Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
|
||||||
|
...
|
||||||
|
30. Set the value of F's [[Fields]] internal slot to fieldRecords.
|
||||||
|
...
|
||||||
|
33. Let result be InitializeStaticFields(F).
|
||||||
|
|
||||||
|
InitializeStaticFields(F)
|
||||||
|
|
||||||
|
3. Let fieldRecords be the value of F's [[Fields]] internal slot.
|
||||||
|
4. For each item fieldRecord in order from fieldRecords,
|
||||||
|
a. If fieldRecord.[[static]] is true, then
|
||||||
|
i. Perform ? DefineField(F, fieldRecord).
|
||||||
|
|
||||||
|
template: default
|
||||||
|
includes: [propertyHelper.js, compareArray.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x = [];
|
||||||
|
//- fields
|
||||||
|
static y = (x.push("a"), "old_value");
|
||||||
|
static ["y"] = (x.push("b"), "another_value");
|
||||||
|
static "y" = (x.push("c"), "same_value");
|
||||||
|
static y = (x.push("d"), "same_value");
|
||||||
|
//- assertions
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false);
|
||||||
|
|
||||||
|
verifyProperty(C, "y", {
|
||||||
|
value: "same_value",
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(compareArray(x, ["a", "b", "c", "d"]));
|
||||||
|
|
||||||
|
var c = new C();
|
||||||
|
assert.sameValue(Object.hasOwnProperty.call(c, "y"), false);
|
||||||
|
|
||||||
|
assert(compareArray(x, ["a", "b", "c", "d"]), "static fields are not redefined on class instatiation");
|
@ -13,7 +13,7 @@ info: |
|
|||||||
|
|
||||||
ClassElementName:
|
ClassElementName:
|
||||||
PropertyName
|
PropertyName
|
||||||
template: default
|
template: productions
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/computed-names.case
|
// - src/class-fields/computed-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Computed property names (field definitions after a generator in the same line)
|
description: Computed property names (field definitions after a generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/computed-symbol-names.case
|
// - src/class-fields/computed-symbol-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Computed property symbol names (field definitions after a generator in the same line)
|
description: Computed property symbol names (field definitions after a generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/literal-names.case
|
// - src/class-fields/literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Literal property names (field definitions after a generator in the same line)
|
description: Literal property names (field definitions after a generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (field definitions after a generator in the same line)
|
description: static literal private names (field definitions after a generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-computed-names.case
|
// - src/class-fields/static-computed-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Static Computed property names (field definitions after a generator in the same line)
|
description: Static Computed property names (field definitions after a generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-computed-symbol-names.case
|
// - src/class-fields/static-computed-symbol-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Static computed property symbol names (field definitions after a generator in the same line)
|
description: Static computed property symbol names (field definitions after a generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
@ -25,7 +25,7 @@ var y = Symbol();
|
|||||||
|
|
||||||
|
|
||||||
var C = class {
|
var C = class {
|
||||||
*m() { return 42; } [x]; [y] = 42;
|
*m() { return 42; } static [x]; static [y] = 42;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,9 @@ verifyProperty(C.prototype, "m", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, x), false);
|
||||||
|
|
||||||
verifyProperty(c, x, {
|
verifyProperty(C, x, {
|
||||||
value: undefined,
|
value: undefined,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
@ -52,9 +52,9 @@ verifyProperty(c, x, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, y), false);
|
||||||
|
|
||||||
verifyProperty(c, y, {
|
verifyProperty(C, y, {
|
||||||
value: 42,
|
value: 42,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-literal-names.case
|
// - src/class-fields/static-literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Static literal property names (field definitions after a generator in the same line)
|
description: Static literal property names (field definitions after a generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-private-names.case
|
// - src/class-fields/static-private-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: literal private names (field definitions after a generator in the same line)
|
description: literal private names (field definitions after a generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/string-literal-names.case
|
// - src/class-fields/string-literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: String literal names (field definitions after a generator in the same line)
|
description: String literal names (field definitions after a generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/computed-names.case
|
// - src/class-fields/computed-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Computed property names (field definitions after a method in the same line)
|
description: Computed property names (field definitions after a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/computed-symbol-names.case
|
// - src/class-fields/computed-symbol-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Computed property symbol names (field definitions after a method in the same line)
|
description: Computed property symbol names (field definitions after a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/literal-names.case
|
// - src/class-fields/literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Literal property names (field definitions after a method in the same line)
|
description: Literal property names (field definitions after a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (field definitions after a method in the same line)
|
description: static literal private names (field definitions after a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-computed-names.case
|
// - src/class-fields/static-computed-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Static Computed property names (field definitions after a method in the same line)
|
description: Static Computed property names (field definitions after a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-computed-symbol-names.case
|
// - src/class-fields/static-computed-symbol-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Static computed property symbol names (field definitions after a method in the same line)
|
description: Static computed property symbol names (field definitions after a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
@ -25,7 +25,7 @@ var y = Symbol();
|
|||||||
|
|
||||||
|
|
||||||
var C = class {
|
var C = class {
|
||||||
m() { return 42; } [x]; [y] = 42;
|
m() { return 42; } static [x]; static [y] = 42;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,9 @@ verifyProperty(C.prototype, "m", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, x), false);
|
||||||
|
|
||||||
verifyProperty(c, x, {
|
verifyProperty(C, x, {
|
||||||
value: undefined,
|
value: undefined,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
@ -52,9 +52,9 @@ verifyProperty(c, x, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, y), false);
|
||||||
|
|
||||||
verifyProperty(c, y, {
|
verifyProperty(C, y, {
|
||||||
value: 42,
|
value: 42,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-literal-names.case
|
// - src/class-fields/static-literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Static literal property names (field definitions after a method in the same line)
|
description: Static literal property names (field definitions after a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-private-names.case
|
// - src/class-fields/static-private-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: literal private names (field definitions after a method in the same line)
|
description: literal private names (field definitions after a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/string-literal-names.case
|
// - src/class-fields/string-literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: String literal names (field definitions after a method in the same line)
|
description: String literal names (field definitions after a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/computed-names.case
|
// - src/class-fields/computed-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Computed property names (field definitions after a static async generator in the same line)
|
description: Computed property names (field definitions after a static async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/computed-symbol-names.case
|
// - src/class-fields/computed-symbol-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Computed property symbol names (field definitions after a static async generator in the same line)
|
description: Computed property symbol names (field definitions after a static async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/literal-names.case
|
// - src/class-fields/literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Literal property names (field definitions after a static async generator in the same line)
|
description: Literal property names (field definitions after a static async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (field definitions after a static async generator in the same line)
|
description: static literal private names (field definitions after a static async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-computed-names.case
|
// - src/class-fields/static-computed-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Static Computed property names (field definitions after a static async generator in the same line)
|
description: Static Computed property names (field definitions after a static async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-computed-symbol-names.case
|
// - src/class-fields/static-computed-symbol-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Static computed property symbol names (field definitions after a static async generator in the same line)
|
description: Static computed property symbol names (field definitions after a static async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
@ -25,7 +25,7 @@ var y = Symbol();
|
|||||||
|
|
||||||
|
|
||||||
var C = class {
|
var C = class {
|
||||||
static async *m() { return 42; } [x]; [y] = 42;
|
static async *m() { return 42; } static [x]; static [y] = 42;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ verifyProperty(C, "m", {
|
|||||||
}, {restore: true});
|
}, {restore: true});
|
||||||
|
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, x), false);
|
||||||
|
|
||||||
verifyProperty(c, x, {
|
verifyProperty(C, x, {
|
||||||
value: undefined,
|
value: undefined,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
@ -51,9 +51,9 @@ verifyProperty(c, x, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, y), false);
|
||||||
|
|
||||||
verifyProperty(c, y, {
|
verifyProperty(C, y, {
|
||||||
value: 42,
|
value: 42,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-literal-names.case
|
// - src/class-fields/static-literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: Static literal property names (field definitions after a static async generator in the same line)
|
description: Static literal property names (field definitions after a static async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-private-names.case
|
// - src/class-fields/static-private-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: literal private names (field definitions after a static async generator in the same line)
|
description: literal private names (field definitions after a static async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/string-literal-names.case
|
// - src/class-fields/string-literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: String literal names (field definitions after a static async generator in the same line)
|
description: String literal names (field definitions after a static async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/computed-names.case
|
// - src/class-fields/computed-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Computed property names (field definitions after a static async method in the same line)
|
description: Computed property names (field definitions after a static async method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/computed-symbol-names.case
|
// - src/class-fields/computed-symbol-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Computed property symbol names (field definitions after a static async method in the same line)
|
description: Computed property symbol names (field definitions after a static async method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/literal-names.case
|
// - src/class-fields/literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Literal property names (field definitions after a static async method in the same line)
|
description: Literal property names (field definitions after a static async method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (field definitions after a static async method in the same line)
|
description: static literal private names (field definitions after a static async method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-computed-names.case
|
// - src/class-fields/static-computed-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Static Computed property names (field definitions after a static async method in the same line)
|
description: Static Computed property names (field definitions after a static async method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-computed-symbol-names.case
|
// - src/class-fields/static-computed-symbol-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Static computed property symbol names (field definitions after a static async method in the same line)
|
description: Static computed property symbol names (field definitions after a static async method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
@ -25,7 +25,7 @@ var y = Symbol();
|
|||||||
|
|
||||||
|
|
||||||
var C = class {
|
var C = class {
|
||||||
static async m() { return 42; } [x]; [y] = 42;
|
static async m() { return 42; } static [x]; static [y] = 42;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ verifyProperty(C, "m", {
|
|||||||
}, {restore: true});
|
}, {restore: true});
|
||||||
|
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, x), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, x), false);
|
||||||
|
|
||||||
verifyProperty(c, x, {
|
verifyProperty(C, x, {
|
||||||
value: undefined,
|
value: undefined,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
@ -51,9 +51,9 @@ verifyProperty(c, x, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
|
||||||
assert.sameValue(Object.hasOwnProperty.call(C, y), false);
|
assert.sameValue(Object.hasOwnProperty.call(c, y), false);
|
||||||
|
|
||||||
verifyProperty(c, y, {
|
verifyProperty(C, y, {
|
||||||
value: 42,
|
value: 42,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
writable: true,
|
writable: true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-literal-names.case
|
// - src/class-fields/static-literal-names.case
|
||||||
// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
|
||||||
/*---
|
/*---
|
||||||
description: Static literal property names (field definitions after a static async method in the same line)
|
description: Static literal property names (field definitions after a static async method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user