2017-10-21 02:39:24 +02:00
|
|
|
// 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
|
|
|
|
/*---
|
2017-10-31 19:49:00 +01:00
|
|
|
description: class fields forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
|
2017-10-21 02:39:24 +02:00
|
|
|
esid: sec-class-definitions-static-semantics-early-errors
|
2017-11-28 18:49:12 +01:00
|
|
|
features: [class, class-fields-public]
|
2017-10-21 02:39:24 +02:00
|
|
|
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 {
|
2017-11-10 21:06:00 +01:00
|
|
|
[x];
|
2017-10-21 02:39:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var c = new C();
|
|
|
|
|
|
|
|
assert.sameValue(c.hasOwnProperty("constructor"), true);
|
2017-11-10 21:06:00 +01:00
|
|
|
assert.sameValue(C.hasOwnProperty("constructor"), false);
|