Merge pull request #1309 from bocoup/classfields-stringname

classfields: add tests for forbidden public/private propertynames
This commit is contained in:
Leo Balter 2017-11-03 14:02:27 -04:00 committed by GitHub
commit 20a2572ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 1035 additions and 0 deletions

View File

@ -0,0 +1,18 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: class fields forbid PropName 'constructor'
info: |
// This test file tests the following early error:
Static Semantics: Early Errors
ClassElement : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
features: [class-fields]
template: propname-error
---*/
//- propname
constructor

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-name-
name: no early error -- PropName of ComputedPropertyName not forbidden value
info: |
Static Semantics: PropName
...
ComputedPropertyName : [ AssignmentExpression ]
Return empty.
---*/
var x = "/*{ propname }*/";
class C {
/*{ static }*/ [x];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true);

View File

@ -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 }*/;
}

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-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 }*/';
}

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

@ -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-name-
name: no early error -- PropName of ComputedPropertyName not forbidden value
info: |
Static Semantics: PropName
...
ComputedPropertyName : [ AssignmentExpression ]
Return empty.
---*/
var x = "/*{ propname }*/";
var C = class {
/*{ static }*/ [x];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true);

View File

@ -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 }*/;
}

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-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 }*/';
}

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

@ -0,0 +1,20 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: static class field forbid PropName 'constructor'
info: |
// 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".
features: [class-fields]
template: propname-error
---*/
//- static
static
//- propname
constructor

View File

@ -0,0 +1,20 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: static class fields forbid PropName 'prototype'
info: |
// 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".
features: [class-fields]
template: propname-error
---*/
//- static
static
//- propname
prototype

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/propname-constructor.case
// - src/class-fields/propname-error/cls-expr-computed-name.template
/*---
description: class fields forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
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 : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
var x = "constructor";
var C = class {
[x];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("constructor"), true);

View File

@ -0,0 +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
/*---
description: static class field forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
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".
---*/
var x = "constructor";
var C = class {
static [x];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("constructor"), true);

View File

@ -0,0 +1,32 @@
// 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
/*---
description: static class fields forbid PropName 'prototype' (no early error -- PropName of ComputedPropertyName not forbidden value)
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".
---*/
var x = "prototype";
var C = class {
static [x];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("prototype"), true);

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/propname-constructor.case
// - src/class-fields/propname-error/cls-expr-variable-name.template
/*---
description: class fields forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
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 : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
var constructor = 'foo';
var C = class {
[constructor];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("foo"), true);

View File

@ -0,0 +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-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
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".
---*/
var constructor = 'foo';
var C = class {
static [constructor];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("foo"), true);

View File

@ -0,0 +1,32 @@
// 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
/*---
description: static class fields forbid PropName 'prototype' (no early error -- PropName of ComputedPropertyName not forbidden value)
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".
---*/
var prototype = 'foo';
var C = class {
static [prototype];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("foo"), true);

View File

@ -0,0 +1,31 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/propname-constructor.case
// - src/class-fields/propname-error/cls-expr-literal-name.template
/*---
description: class fields forbid PropName 'constructor' (early error -- PropName of IdentifierName is forbidden)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
LiteralPropertyName : IdentifierName
Return StringValue of IdentifierName.
// This test file tests the following early error:
Static Semantics: Early Errors
ClassElement : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
throw "Test262: This statement should not be evaluated.";
var C = class {
constructor;
}

View File

@ -0,0 +1,31 @@
// 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
/*---
description: static class field forbid PropName 'constructor' (early error -- PropName of IdentifierName is forbidden)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
LiteralPropertyName : IdentifierName
Return StringValue of IdentifierName.
// 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".
---*/
throw "Test262: This statement should not be evaluated.";
var C = class {
static constructor;
}

View File

@ -0,0 +1,31 @@
// 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
/*---
description: static class fields forbid PropName 'prototype' (early error -- PropName of IdentifierName is forbidden)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
LiteralPropertyName : IdentifierName
Return StringValue of IdentifierName.
// 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".
---*/
throw "Test262: This statement should not be evaluated.";
var C = class {
static prototype;
}

View File

@ -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.
/*---
description: Private class fields early error with StringValue "#constructor"
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
negative:
phase: early
type: SyntaxError
info: |
ClassElementName : PrivateName;
It is a Syntax Error if StringValue of PrivateName is "#constructor".
---*/
throw "Test262: This statement should not be evaluated.";
var C = class {
#constructor;
}

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/propname-constructor.case
// - src/class-fields/propname-error/cls-expr-string-name.template
/*---
description: class fields forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
...
LiteralPropertyName : StringLiteral
Return the String value whose code units are the SV of the StringLiteral.
// This test file tests the following early error:
Static Semantics: Early Errors
ClassElement : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
throw "Test262: This statement should not be evaluated.";
var C = class {
'constructor';
}

View File

@ -0,0 +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-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
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
...
LiteralPropertyName : StringLiteral
Return the String value whose code units are the SV of the StringLiteral.
// 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".
---*/
throw "Test262: This statement should not be evaluated.";
var C = class {
static 'constructor';
}

View File

@ -0,0 +1,32 @@
// 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
/*---
description: static class fields forbid PropName 'prototype' (early error -- PropName of StringLiteral is forbidden)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
...
LiteralPropertyName : StringLiteral
Return the String value whose code units are the SV of the StringLiteral.
// 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".
---*/
throw "Test262: This statement should not be evaluated.";
var C = class {
static 'prototype';
}

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/propname-constructor.case
// - src/class-fields/propname-error/cls-decl-computed-name.template
/*---
description: class fields forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
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 : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
var x = "constructor";
class C {
[x];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("constructor"), true);

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-propname-constructor.case
// - src/class-fields/propname-error/cls-decl-computed-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
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".
---*/
var x = "constructor";
class C {
static [x];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("constructor"), true);

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-propname-prototype.case
// - src/class-fields/propname-error/cls-decl-computed-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
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".
---*/
var x = "prototype";
class C {
static [x];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("prototype"), true);

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/propname-constructor.case
// - src/class-fields/propname-error/cls-decl-variable-name.template
/*---
description: class fields forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
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 : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
var constructor = 'foo';
class C {
[constructor];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("foo"), true);

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-propname-constructor.case
// - src/class-fields/propname-error/cls-decl-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
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".
---*/
var constructor = 'foo';
class C {
static [constructor];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("foo"), true);

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-propname-prototype.case
// - src/class-fields/propname-error/cls-decl-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
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".
---*/
var prototype = 'foo';
class C {
static [prototype];
}
var c = new C();
assert.sameValue(c.hasOwnProperty("foo"), true);

View File

@ -0,0 +1,31 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/propname-constructor.case
// - src/class-fields/propname-error/cls-decl-literal-name.template
/*---
description: class fields forbid PropName 'constructor' (early error -- PropName of IdentifierName is forbidden value)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
LiteralPropertyName : IdentifierName
Return StringValue of IdentifierName.
// This test file tests the following early error:
Static Semantics: Early Errors
ClassElement : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
throw "Test262: This statement should not be evaluated.";
class C {
constructor;
}

View File

@ -0,0 +1,31 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-propname-constructor.case
// - src/class-fields/propname-error/cls-decl-literal-name.template
/*---
description: static class field forbid PropName 'constructor' (early error -- PropName of IdentifierName is forbidden value)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
LiteralPropertyName : IdentifierName
Return StringValue of IdentifierName.
// 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".
---*/
throw "Test262: This statement should not be evaluated.";
class C {
static constructor;
}

View File

@ -0,0 +1,31 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-propname-prototype.case
// - src/class-fields/propname-error/cls-decl-literal-name.template
/*---
description: static class fields forbid PropName 'prototype' (early error -- PropName of IdentifierName is forbidden value)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
LiteralPropertyName : IdentifierName
Return StringValue of IdentifierName.
// 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".
---*/
throw "Test262: This statement should not be evaluated.";
class C {
static prototype;
}

View File

@ -0,0 +1,20 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Private class fields early error with StringValue "#constructor"
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
negative:
phase: early
type: SyntaxError
info: |
ClassElementName : PrivateName;
It is a Syntax Error if StringValue of PrivateName is "#constructor".
---*/
throw "Test262: This statement should not be evaluated.";
class C {
#constructor;
}

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/propname-constructor.case
// - src/class-fields/propname-error/cls-decl-string-name.template
/*---
description: class fields forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden value)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
...
LiteralPropertyName : StringLiteral
Return the String value whose code units are the SV of the StringLiteral.
// This test file tests the following early error:
Static Semantics: Early Errors
ClassElement : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
throw "Test262: This statement should not be evaluated.";
class C {
'constructor';
}

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-propname-constructor.case
// - src/class-fields/propname-error/cls-decl-string-name.template
/*---
description: static class field forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden value)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
...
LiteralPropertyName : StringLiteral
Return the String value whose code units are the SV of the StringLiteral.
// 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".
---*/
throw "Test262: This statement should not be evaluated.";
class C {
static 'constructor';
}

View File

@ -0,0 +1,32 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-propname-prototype.case
// - src/class-fields/propname-error/cls-decl-string-name.template
/*---
description: static class fields forbid PropName 'prototype' (early error -- PropName of StringLiteral is forbidden value)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
flags: [generated]
negative:
phase: early
type: SyntaxError
info: |
Static Semantics: PropName
...
LiteralPropertyName : StringLiteral
Return the String value whose code units are the SV of the StringLiteral.
// 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".
---*/
throw "Test262: This statement should not be evaluated.";
class C {
static 'prototype';
}