Fixes for forbidden property names

This commit is contained in:
Valerie R Young 2017-10-31 14:19:30 -04:00
parent 2664e17e1d
commit 889857ccb5
11 changed files with 55 additions and 11 deletions

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file. // 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: | info: |
// This test file tests the following early error: // This test file tests the following early error:

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-class-definitions-static-semantics-early-errors esid: sec-class-definitions-static-semantics-early-errors
path: language/statements/class/fields-computed-name- path: language/statements/class/fields-computed-name-
name: computed name: no early error -- PropName of ComputedPropertyName not forbidden value
info: | info: |
Static Semantics: PropName Static Semantics: PropName
... ...

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-class-definitions-static-semantics-early-errors esid: sec-class-definitions-static-semantics-early-errors
path: language/statements/class/fields-literal-name- path: language/statements/class/fields-literal-name-
name: literal name name: early error -- PropName of IdentifierName is forbidden value
negative: negative:
type: SyntaxError type: SyntaxError
phase: early phase: early

View File

@ -4,14 +4,14 @@
/*--- /*---
esid: sec-class-definitions-static-semantics-early-errors esid: sec-class-definitions-static-semantics-early-errors
path: language/statements/class/fields-string-name- path: language/statements/class/fields-string-name-
name: string name name: early error -- PropName of StringLiteral is forbidden value
negative: negative:
type: SyntaxError type: SyntaxError
phase: early phase: early
info: | info: |
Static Semantics: PropName Static Semantics: PropName
... ...
LiteralPropertyName:StringLiteral LiteralPropertyName : StringLiteral
Return the String value whose code units are the SV of the StringLiteral. Return the String value whose code units are the SV of the StringLiteral.
---*/ ---*/

View File

@ -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);

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-class-definitions-static-semantics-early-errors esid: sec-class-definitions-static-semantics-early-errors
path: language/expressions/class/fields-computed-name- path: language/expressions/class/fields-computed-name-
name: computed name: no early error -- PropName of ComputedPropertyName not forbidden value
info: | info: |
Static Semantics: PropName Static Semantics: PropName
... ...

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-class-definitions-static-semantics-early-errors esid: sec-class-definitions-static-semantics-early-errors
path: language/expressions/class/fields-literal-name- path: language/expressions/class/fields-literal-name-
name: literal name name: early error -- PropName of IdentifierName is forbidden
negative: negative:
type: SyntaxError type: SyntaxError
phase: early phase: early

View File

@ -4,14 +4,14 @@
/*--- /*---
esid: sec-class-definitions-static-semantics-early-errors esid: sec-class-definitions-static-semantics-early-errors
path: language/expressions/class/fields-string-name- path: language/expressions/class/fields-string-name-
name: string name name: early error -- PropName of StringLiteral is forbidden
negative: negative:
type: SyntaxError type: SyntaxError
phase: early phase: early
info: | info: |
Static Semantics: PropName Static Semantics: PropName
... ...
LiteralPropertyName:StringLiteral LiteralPropertyName : StringLiteral
Return the String value whose code units are the SV of the StringLiteral. Return the String value whose code units are the SV of the StringLiteral.
---*/ ---*/

View File

@ -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);

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file. // 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: | info: |
// This test file tests the following early error: // This test file tests the following early error:

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file. // 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: | info: |
// This test file tests the following early error: // This test file tests the following early error: