mirror of https://github.com/tc39/test262.git
* Accessing `ta[0]` throws a TypeError. * Fix array indices starting at 0 and property references * Fix classfields templates for properly checking static propnames. * Generate tests * `assert.equal` is not defined * Add missing includes * Generate tests * typo s/Avalue/42/ * fix whitespace * Add missing var for strict mode * Expand generated class fields tests for forbidden computed property name values Ref https://github.com/tc39/test262/pull/1339#issuecomment-342830243 * derived classes have access to private names in base classes, if private names are in scope
This commit is contained in:
parent
c4e3d12597
commit
076ecc38c6
|
@ -7,6 +7,7 @@ name: field definitions after an async generator in the same line
|
|||
features: [class-fields, async-iteration]
|
||||
flags: [async]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -7,6 +7,7 @@ name: field definitions after an async method in the same line
|
|||
features: [class-fields, async-functions]
|
||||
flags: [async]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-after-same-line-gen-
|
|||
name: field definitions after a generator in the same line
|
||||
features: [generators, class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-after-same-line-method-
|
|||
name: field definitions after a method in the same line
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -7,6 +7,7 @@ name: field definitions after a static async generator in the same line
|
|||
features: [class-fields, async-iteration]
|
||||
flags: [async]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -7,6 +7,7 @@ name: field definitions after a static async method in the same line
|
|||
features: [class-fields, async-functions]
|
||||
flags: [async]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-after-same-line-static-gen-
|
|||
name: field definitions after a static generator in the same line
|
||||
features: [generators, class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-after-same-line-static-method-
|
|||
name: field definitions after a static method in the same line
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-multiple-definitions-
|
|||
name: multiple fields definitions
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-multiple-stacked-definitions-
|
|||
name: multiple stacked fields definitions through ASI
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-new-no-sc-line-method-
|
|||
name: field definitions followed by a method in a new line without a semicolon
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-new-sc-line-gen-
|
|||
name: field definitions followed by a method in a new line with a semicolon
|
||||
features: [class-fields, generators]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-new-sc-line-method-
|
|||
name: field definitions followed by a method in a new line with a semicolon
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-same-line-gen-
|
|||
name: field definitions followed by a generator method in the same line
|
||||
features: [class-fields, generators]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/statements/class/fields-same-line-method-
|
|||
name: field definitions followed by a method in the same line
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
|
|
|
@ -7,6 +7,7 @@ name: field definitions after an async generator in the same line
|
|||
features: [class-fields, async-iteration]
|
||||
flags: [async]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -7,6 +7,7 @@ name: field definitions after an async method in the same line
|
|||
features: [class-fields, async-functions]
|
||||
flags: [async]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-after-same-line-gen-
|
|||
name: field definitions after a generator in the same line
|
||||
features: [generators, class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-after-same-line-method-
|
|||
name: field definitions after a method in the same line
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -7,6 +7,7 @@ name: field definitions after a static async generator in the same line
|
|||
features: [class-fields, async-iteration]
|
||||
flags: [async]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -7,6 +7,7 @@ name: field definitions after a static async method in the same line
|
|||
features: [class-fields, async-functions]
|
||||
flags: [async]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-after-same-line-static-gen-
|
|||
name: field definitions after a static generator in the same line
|
||||
features: [generators, class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-after-same-line-static-method-
|
|||
name: field definitions after a static method in the same line
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-multiple-definitions-
|
|||
name: multiple fields definitions
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-multiple-stacked-definitions-
|
|||
name: multiple stacked fields definitions through ASI
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-new-no-sc-line-method-
|
|||
name: field definitions followed by a method in a new line without a semicolon
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-new-sc-line-gen-
|
|||
name: field definitions followed by a method in a new line with a semicolon
|
||||
features: [class-fields, generators]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-new-sc-line-method-
|
|||
name: field definitions followed by a method in a new line with a semicolon
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-same-line-gen-
|
|||
name: field definitions followed by a generator method in the same line
|
||||
features: [class-fields, generators]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -6,6 +6,7 @@ path: language/expressions/class/fields-same-line-method-
|
|||
name: field definitions followed by a method in the same line
|
||||
features: [class-fields]
|
||||
esid: prod-FieldDefinition
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/statements/class/fields-literal-name-
|
||||
name: early error -- PropName of IdentifierName is forbidden value
|
||||
negative:
|
||||
type: SyntaxError
|
||||
phase: early
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
LiteralPropertyName : IdentifierName
|
||||
Return StringValue of IdentifierName.
|
||||
---*/
|
||||
|
||||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
class C {
|
||||
static /*{ propname }*/;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/statements/class/fields-string-name-
|
||||
name: early error -- PropName of StringLiteral is forbidden value
|
||||
negative:
|
||||
type: SyntaxError
|
||||
phase: early
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
...
|
||||
LiteralPropertyName : StringLiteral
|
||||
Return the String value whose code units are the SV of the StringLiteral.
|
||||
---*/
|
||||
|
||||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
class C {
|
||||
static '/*{ propname }*/';
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/statements/class/fields-computed-variable-name-
|
||||
name: no early error -- PropName of ComputedPropertyName not forbidden value
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
...
|
||||
ComputedPropertyName : [ AssignmentExpression ]
|
||||
Return empty.
|
||||
---*/
|
||||
|
||||
var /*{ propname }*/ = "foo";
|
||||
class C {
|
||||
static [/*{ propname }*/];
|
||||
}
|
||||
|
||||
assert.sameValue(C.hasOwnProperty("foo"), true);
|
||||
|
||||
var c = new C();
|
||||
assert.sameValue(c.hasOwnProperty("foo"), false);
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/expressions/class/fields-literal-name-
|
||||
name: early error -- PropName of IdentifierName is forbidden
|
||||
negative:
|
||||
type: SyntaxError
|
||||
phase: early
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
LiteralPropertyName : IdentifierName
|
||||
Return StringValue of IdentifierName.
|
||||
---*/
|
||||
|
||||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
var C = class {
|
||||
static /*{ propname }*/;
|
||||
};
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/expressions/class/fields-string-name-
|
||||
name: early error -- PropName of StringLiteral is forbidden
|
||||
negative:
|
||||
type: SyntaxError
|
||||
phase: early
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
...
|
||||
LiteralPropertyName : StringLiteral
|
||||
Return the String value whose code units are the SV of the StringLiteral.
|
||||
---*/
|
||||
|
||||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
var C = class {
|
||||
static '/*{ propname }*/';
|
||||
};
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/expressions/class/fields-computed-variable-name-
|
||||
name: no early error -- PropName of ComputedPropertyName not forbidden value
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
...
|
||||
ComputedPropertyName : [ AssignmentExpression ]
|
||||
Return empty.
|
||||
---*/
|
||||
|
||||
var /*{ propname }*/ = 'foo';
|
||||
var C = class {
|
||||
static [/*{ propname }*/];
|
||||
};
|
||||
|
||||
assert.sameValue(C.hasOwnProperty("foo"), true);
|
||||
|
||||
var c = new C();
|
||||
assert.sameValue(c.hasOwnProperty("foo"), false);
|
|
@ -14,9 +14,10 @@ info: |
|
|||
|
||||
var x = "/*{ propname }*/";
|
||||
class C {
|
||||
/*{ static }*/ [x];
|
||||
[x];
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true);
|
||||
assert.sameValue(C.hasOwnProperty("/*{ propname }*/"), false);
|
||||
|
|
|
@ -17,5 +17,5 @@ info: |
|
|||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
class C {
|
||||
/*{ static }*/ /*{ propname }*/;
|
||||
/*{ propname }*/;
|
||||
}
|
||||
|
|
|
@ -18,5 +18,5 @@ info: |
|
|||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
class C {
|
||||
/*{ static }*/ '/*{ propname }*/';
|
||||
'/*{ propname }*/';
|
||||
}
|
||||
|
|
|
@ -14,9 +14,10 @@ info: |
|
|||
|
||||
var /*{ propname }*/ = 'foo';
|
||||
class C {
|
||||
/*{ static }*/ [/*{ propname }*/];
|
||||
[/*{ propname }*/];
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("foo"), true);
|
||||
assert.sameValue(C.hasOwnProperty("foo"), false);
|
||||
|
|
|
@ -14,9 +14,10 @@ info: |
|
|||
|
||||
var x = "/*{ propname }*/";
|
||||
var C = class {
|
||||
/*{ static }*/ [x];
|
||||
}
|
||||
[x];
|
||||
};
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true);
|
||||
|
||||
assert.sameValue(C.hasOwnProperty("/*{ propname }*/"), false);
|
||||
|
|
|
@ -17,5 +17,5 @@ info: |
|
|||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
var C = class {
|
||||
/*{ static }*/ /*{ propname }*/;
|
||||
}
|
||||
/*{ propname }*/;
|
||||
};
|
||||
|
|
|
@ -18,5 +18,5 @@ info: |
|
|||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
var C = class {
|
||||
/*{ static }*/ '/*{ propname }*/';
|
||||
}
|
||||
'/*{ propname }*/';
|
||||
};
|
||||
|
|
|
@ -14,9 +14,10 @@ info: |
|
|||
|
||||
var /*{ propname }*/ = 'foo';
|
||||
var C = class {
|
||||
/*{ static }*/ [/*{ propname }*/];
|
||||
}
|
||||
[/*{ propname }*/];
|
||||
};
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("foo"), true);
|
||||
|
||||
assert.sameValue(C.hasOwnProperty("foo"), false);
|
||||
|
|
|
@ -11,10 +11,8 @@ info: |
|
|||
ClassElement : staticFieldDefinition;
|
||||
It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
|
||||
features: [class-fields]
|
||||
template: propname-error
|
||||
template: propname-error-static
|
||||
---*/
|
||||
|
||||
//- static
|
||||
static
|
||||
//- propname
|
||||
constructor
|
||||
|
|
|
@ -11,10 +11,8 @@ info: |
|
|||
ClassElement : staticFieldDefinition;
|
||||
It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
|
||||
features: [class-fields]
|
||||
template: propname-error
|
||||
template: propname-error-static
|
||||
---*/
|
||||
|
||||
//- static
|
||||
static
|
||||
//- propname
|
||||
prototype
|
||||
|
|
|
@ -48,6 +48,8 @@ testWithTypedArrayConstructors(function(TA) {
|
|||
"detaching a ArrayBuffer during defining an element of a typed array " +
|
||||
"viewing it should throw");
|
||||
|
||||
assert.sameValue(ta[0], 17, "typed array element shouldn't be set");
|
||||
assert.throws(TypeError, function() {
|
||||
ta[0];
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -40,5 +40,7 @@ testWithTypedArrayConstructors(function(TA) {
|
|||
"detaching a ArrayBuffer during setting an element of a typed array " +
|
||||
"viewing it should throw");
|
||||
|
||||
assert.sameValue(ta[0], 17, "typed array element shouldn't be set");
|
||||
assert.throws(TypeError, function() {
|
||||
ta[0];
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a generator i
|
|||
esid: prod-FieldDefinition
|
||||
features: [generators, class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a generator in the s
|
|||
esid: prod-FieldDefinition
|
||||
features: [generators, class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a method in t
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a method in the same
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a static asyn
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-iteration]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a static async gener
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-iteration]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a static asyn
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-functions]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a static async metho
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-functions]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a static gene
|
|||
esid: prod-FieldDefinition
|
||||
features: [generators, class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a static generator i
|
|||
esid: prod-FieldDefinition
|
||||
features: [generators, class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a static meth
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a static method in t
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -7,9 +7,9 @@ esid: sec-automatic-semicolon-insertion
|
|||
features: [class-fields]
|
||||
---*/
|
||||
|
||||
var x = 1
|
||||
var y = 2
|
||||
var z = [42]
|
||||
var x = 0;
|
||||
var y = 1;
|
||||
var z = [42];
|
||||
|
||||
var C = class {
|
||||
a = x
|
||||
|
@ -22,7 +22,7 @@ var C = class {
|
|||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.a, true, 'a = x in z')
|
||||
assert.sameValue(c.a, false, 'a = y in z')
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "in"), false, "'in' interpreted as index");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "z"), false, "'z' interpreted as variable");
|
||||
assert.sameValue(c.a, true, 'a = x in z');
|
||||
assert.sameValue(c.b, false, 'b = y in z');
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "in"), false, "'in'");
|
||||
assert.sameValue(Object.hasOwnProperty.call(c, "z"), false, "'z'");
|
||||
|
|
|
@ -24,9 +24,10 @@ info: |
|
|||
|
||||
var x = "constructor";
|
||||
var C = class {
|
||||
[x];
|
||||
}
|
||||
[x];
|
||||
};
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("constructor"), true);
|
||||
|
||||
assert.sameValue(C.hasOwnProperty("constructor"), false);
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-fields/static-propname-constructor.case
|
||||
// - src/class-fields/propname-error/cls-expr-computed-name.template
|
||||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: static class field forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
|
||||
description: >
|
||||
static class fields forbid PropName 'constructor' (no early error for
|
||||
ComputedPropertyName)
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
...
|
||||
ComputedPropertyName : [ AssignmentExpression ]
|
||||
Return empty.
|
||||
|
||||
|
||||
// This test file tests the following early error:
|
||||
Static Semantics: Early Errors
|
||||
|
||||
ClassElement : staticFieldDefinition;
|
||||
It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
|
||||
Static Semantics: PropName
|
||||
...
|
||||
ComputedPropertyName : [ AssignmentExpression ]
|
||||
Return empty.
|
||||
|
||||
// This test file also tests the ComputedPropertyName won't trigger the
|
||||
// following early error:
|
||||
Static Semantics: Early Errors
|
||||
|
||||
ClassElement : staticFieldDefinition;
|
||||
It is a Syntax Error if PropName of FieldDefinition is "prototype" or
|
||||
"constructor".
|
||||
---*/
|
||||
|
||||
|
||||
var x = "constructor";
|
||||
var C = class {
|
||||
static [x];
|
||||
}
|
||||
static ["constructor"];
|
||||
};
|
||||
|
||||
assert.sameValue(C.hasOwnProperty("constructor"), true);
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("constructor"), true);
|
||||
assert.sameValue(c.hasOwnProperty("constructor"), false);
|
||||
|
|
|
@ -1,32 +1,58 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-fields/static-propname-prototype.case
|
||||
// - src/class-fields/propname-error/cls-expr-computed-name.template
|
||||
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: static class fields forbid PropName 'prototype' (no early error -- PropName of ComputedPropertyName not forbidden value)
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
description: >
|
||||
Cannot redefine a non-configurable, non-writable "prototype" property
|
||||
esid: runtime-semantics-class-definition-evaluation
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
// This test file also tests the ComputedPropertyName won't trigger the
|
||||
// following early error:
|
||||
Static Semantics: Early Errors
|
||||
|
||||
ClassElement : staticFieldDefinition;
|
||||
It is a Syntax Error if PropName of FieldDefinition is "prototype" or
|
||||
"constructor".
|
||||
|
||||
2.13.2 Runtime Semantics: ClassDefinitionEvaluation
|
||||
|
||||
...
|
||||
21. Perform MakeConstructor(F, false, proto).
|
||||
...
|
||||
25. Else, let elements be NonConstructorMethodDefinitions of ClassBody.
|
||||
26. Let fieldRecords be a new empty List.
|
||||
26. For each ClassElement me 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.
|
||||
...
|
||||
ComputedPropertyName : [ AssignmentExpression ]
|
||||
Return empty.
|
||||
33. Let result be InitializeStaticFields(F).
|
||||
...
|
||||
|
||||
|
||||
// This test file tests the following early error:
|
||||
Static Semantics: Early Errors
|
||||
// ClassElementEvaluation should evaluate the ComputedPropertyName
|
||||
|
||||
ClassElement : staticFieldDefinition;
|
||||
It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
|
||||
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).
|
||||
|
||||
// And the Static Fields should be defined to the class
|
||||
|
||||
2.8 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).
|
||||
---*/
|
||||
|
||||
|
||||
var x = "prototype";
|
||||
var C = class {
|
||||
static [x];
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("prototype"), true);
|
||||
assert.throws(TypeError, function() {
|
||||
var C = class {
|
||||
static ["prototype"];
|
||||
};
|
||||
});
|
||||
|
|
|
@ -24,9 +24,10 @@ info: |
|
|||
|
||||
var constructor = 'foo';
|
||||
var C = class {
|
||||
[constructor];
|
||||
}
|
||||
[constructor];
|
||||
};
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("foo"), true);
|
||||
|
||||
assert.sameValue(C.hasOwnProperty("foo"), false);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-fields/static-propname-constructor.case
|
||||
// - src/class-fields/propname-error/cls-expr-variable-name.template
|
||||
// - src/class-fields/propname-error-static/cls-expr-static-variable-name.template
|
||||
/*---
|
||||
description: static class field forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
|
@ -25,8 +25,9 @@ info: |
|
|||
var constructor = 'foo';
|
||||
var C = class {
|
||||
static [constructor];
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(C.hasOwnProperty("foo"), true);
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("foo"), true);
|
||||
assert.sameValue(c.hasOwnProperty("foo"), false);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-fields/static-propname-prototype.case
|
||||
// - src/class-fields/propname-error/cls-expr-variable-name.template
|
||||
// - src/class-fields/propname-error-static/cls-expr-static-variable-name.template
|
||||
/*---
|
||||
description: static class fields forbid PropName 'prototype' (no early error -- PropName of ComputedPropertyName not forbidden value)
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
|
@ -25,8 +25,9 @@ info: |
|
|||
var prototype = 'foo';
|
||||
var C = class {
|
||||
static [prototype];
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(C.hasOwnProperty("foo"), true);
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("foo"), true);
|
||||
assert.sameValue(c.hasOwnProperty("foo"), false);
|
||||
|
|
|
@ -27,5 +27,5 @@ info: |
|
|||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
var C = class {
|
||||
constructor;
|
||||
}
|
||||
constructor;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-fields/static-propname-constructor.case
|
||||
// - src/class-fields/propname-error/cls-expr-literal-name.template
|
||||
// - src/class-fields/propname-error-static/cls-expr-static-literal-name.template
|
||||
/*---
|
||||
description: static class field forbid PropName 'constructor' (early error -- PropName of IdentifierName is forbidden)
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
|
@ -28,4 +28,4 @@ throw "Test262: This statement should not be evaluated.";
|
|||
|
||||
var C = class {
|
||||
static constructor;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-fields/static-propname-prototype.case
|
||||
// - src/class-fields/propname-error/cls-expr-literal-name.template
|
||||
// - src/class-fields/propname-error-static/cls-expr-static-literal-name.template
|
||||
/*---
|
||||
description: static class fields forbid PropName 'prototype' (early error -- PropName of IdentifierName is forbidden)
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
|
@ -28,4 +28,4 @@ throw "Test262: This statement should not be evaluated.";
|
|||
|
||||
var C = class {
|
||||
static prototype;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (multiple fields definitions)
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (multiple fields definitions)
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (multiple stacked fields definitions t
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (multiple stacked fields definitions through
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions followed by a metho
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions followed by a method in a
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions followed by a metho
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, generators]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions followed by a method in a
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, generators]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions followed by a metho
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions followed by a method in a
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after an async gene
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-iteration]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after an async generator i
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-iteration]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after an async meth
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-functions]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after an async method in t
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-functions]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions followed by a gener
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, generators]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions followed by a generator me
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, generators]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions followed by a metho
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions followed by a method in th
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -28,5 +28,5 @@ info: |
|
|||
throw "Test262: This statement should not be evaluated.";
|
||||
|
||||
var C = class {
|
||||
'constructor';
|
||||
}
|
||||
'constructor';
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-fields/static-propname-constructor.case
|
||||
// - src/class-fields/propname-error/cls-expr-string-name.template
|
||||
// - src/class-fields/propname-error-static/cls-expr-static-string-name.template
|
||||
/*---
|
||||
description: static class field forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden)
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
|
@ -29,4 +29,4 @@ throw "Test262: This statement should not be evaluated.";
|
|||
|
||||
var C = class {
|
||||
static 'constructor';
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-fields/static-propname-prototype.case
|
||||
// - src/class-fields/propname-error/cls-expr-string-name.template
|
||||
// - src/class-fields/propname-error-static/cls-expr-static-string-name.template
|
||||
/*---
|
||||
description: static class fields forbid PropName 'prototype' (early error -- PropName of StringLiteral is forbidden)
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
|
@ -29,4 +29,4 @@ throw "Test262: This statement should not be evaluated.";
|
|||
|
||||
var C = class {
|
||||
static 'prototype';
|
||||
}
|
||||
};
|
||||
|
|
|
@ -44,4 +44,4 @@ class outer {
|
|||
var innerclass = new outer().f();
|
||||
var test = new innerclass().g();
|
||||
|
||||
assert.equal(test, 42);
|
||||
assert.sameValue(test, 42);
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a generator i
|
|||
esid: prod-FieldDefinition
|
||||
features: [generators, class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a generator in the s
|
|||
esid: prod-FieldDefinition
|
||||
features: [generators, class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a method in t
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a method in the same
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields]
|
||||
flags: [generated]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a static asyn
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-iteration]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a static async gener
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-iteration]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: static literal private names (field definitions after a static asyn
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-functions]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
|
@ -6,6 +6,7 @@ description: literal private names (field definitions after a static async metho
|
|||
esid: prod-FieldDefinition
|
||||
features: [class-fields, async-functions]
|
||||
flags: [generated, async]
|
||||
includes: [propertyHelper.js]
|
||||
info: |
|
||||
ClassElement:
|
||||
...
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue