Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/fields-string-name-propname-constructor.js

raw
1 // |reftest| error:SyntaxError
2 // Copyright (C) 2017 Valerie Young. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 description: class fields forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden)
6 esid: sec-class-definitions-static-semantics-early-errors
7 features: [class, class-fields-public]
8 negative:
9 phase: parse
10 type: SyntaxError
11 info: |
12 Static Semantics: PropName
13 ...
14 LiteralPropertyName : StringLiteral
15 Return the String value whose code units are the SV of the StringLiteral.
16
17
18 // This test file tests the following early error:
19 Static Semantics: Early Errors
20
21 ClassElement : FieldDefinition;
22 It is a Syntax Error if PropName of FieldDefinition is "constructor".
23
24 ---*/
25
26
27 $DONOTEVALUATE();
28
29 var C = class {
30 'constructor';
31 };