mirror of https://github.com/tc39/test262.git
Fixes for forbidden property names
This commit is contained in:
parent
2664e17e1d
commit
889857ccb5
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: Static class fields cannot have PropName 'constructor'
|
||||
desc: class fields forbid PropName 'constructor'
|
||||
info: |
|
||||
|
||||
// This test file tests the following early error:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/statements/class/fields-computed-name-
|
||||
name: computed
|
||||
name: no early error -- PropName of ComputedPropertyName not forbidden value
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
...
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/statements/class/fields-literal-name-
|
||||
name: literal name
|
||||
name: early error -- PropName of IdentifierName is forbidden value
|
||||
negative:
|
||||
type: SyntaxError
|
||||
phase: early
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/statements/class/fields-string-name-
|
||||
name: string name
|
||||
name: early error -- PropName of StringLiteral is forbidden value
|
||||
negative:
|
||||
type: SyntaxError
|
||||
phase: early
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
...
|
||||
LiteralPropertyName:StringLiteral
|
||||
LiteralPropertyName : StringLiteral
|
||||
Return the String value whose code units are the SV of the StringLiteral.
|
||||
---*/
|
||||
|
||||
|
|
|
@ -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-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 }*/];
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("foo"), true);
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/expressions/class/fields-computed-name-
|
||||
name: computed
|
||||
name: no early error -- PropName of ComputedPropertyName not forbidden value
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
...
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/expressions/class/fields-literal-name-
|
||||
name: literal name
|
||||
name: early error -- PropName of IdentifierName is forbidden
|
||||
negative:
|
||||
type: SyntaxError
|
||||
phase: early
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
/*---
|
||||
esid: sec-class-definitions-static-semantics-early-errors
|
||||
path: language/expressions/class/fields-string-name-
|
||||
name: string name
|
||||
name: early error -- PropName of StringLiteral is forbidden
|
||||
negative:
|
||||
type: SyntaxError
|
||||
phase: early
|
||||
info: |
|
||||
Static Semantics: PropName
|
||||
...
|
||||
LiteralPropertyName:StringLiteral
|
||||
LiteralPropertyName : StringLiteral
|
||||
Return the String value whose code units are the SV of the StringLiteral.
|
||||
---*/
|
||||
|
||||
|
|
|
@ -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-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 }*/];
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
||||
assert.sameValue(c.hasOwnProperty("foo"), true);
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: Static class field cannot have PropName 'constructor'
|
||||
desc: static class field forbid PropName 'constructor'
|
||||
info: |
|
||||
|
||||
// This test file tests the following early error:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: Static class fields cannot have PropName 'prototype'
|
||||
desc: static class fields forbid PropName 'prototype'
|
||||
info: |
|
||||
|
||||
// This test file tests the following early error:
|
||||
|
|
Loading…
Reference in New Issue