Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js

raw
1 // |reftest| error:SyntaxError
2 // This file was procedurally generated from the following sources:
3 // - src/class-elements/grammar-privatename-in-computed-property-missing.case
4 // - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
5 /*---
6 description: Use of undeclared PrivateName in ComputedProperty is a syntax error (class declaration)
7 esid: prod-ClassElement
8 features: [class-fields-private, class-fields-public, class]
9 flags: [generated]
10 negative:
11 phase: parse
12 type: SyntaxError
13 info: |
14 ClassElementName:
15 PropertyName
16 PrivateIdentifier
17
18 PropertyName:
19 LiteralPropertyName
20 ComputedPropertyName
21
22 ComputedPropertyName:
23 [ AssignmentExpression ]
24
25 AssignmentExpression ... MemberExpression
26
27 MemberExpression:
28 MemberExpression . PrivateName
29
30 Static Semantics: AllPrivateIdentifiersValid
31 AllPrivateIdentifiersValid is an abstract operation which takes names as an argument.
32
33 MemberExpression : MemberExpression . PrivateIdentifier
34 1. If StringValue of PrivateIdentifier is in names, return true.
35 2. Return false.
36
37 ClassBody : ClassElementList
38 1. Let newNames be the concatenation of names with PrivateBoundIdentifiers of ClassBody.
39 2. Return AllPrivateIdentifiersValid of ClassElementList with the argument newNames.
40
41 Static Semantics: Early Errors
42
43 ScriptBody : StatementList
44 It is a Syntax Error if AllPrivateIdentifiersValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
45
46 ---*/
47
48
49 $DONOTEVALUATE();
50
51 class C {
52 [this.#f] = 'Test262'
53 }