summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js
blob: ea4682b23444cd91a73fd7bac9c3deb03eb847d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// |reftest| error:SyntaxError
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-privatename-in-computed-property-missing.case
// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
/*---
description: Use of undeclared PrivateName in ComputedProperty is a syntax error (class declaration)
esid: prod-ClassElement
features: [class-fields-private, class-fields-public, class]
flags: [generated]
negative:
  phase: parse
  type: SyntaxError
info: |
    ClassElementName:
      PropertyName
      PrivateIdentifier

    PropertyName:
      LiteralPropertyName
      ComputedPropertyName

    ComputedPropertyName:
      [ AssignmentExpression ]

    AssignmentExpression ... MemberExpression

    MemberExpression:
      MemberExpression . PrivateName

    Static Semantics: AllPrivateIdentifiersValid
      AllPrivateIdentifiersValid is an abstract operation which takes names as an argument.

      MemberExpression : MemberExpression . PrivateIdentifier
        1. If StringValue of PrivateIdentifier is in names, return true.
        2. Return false.

      ClassBody : ClassElementList
        1. Let newNames be the concatenation of names with PrivateBoundIdentifiers of ClassBody.
        2. Return AllPrivateIdentifiersValid of ClassElementList with the argument newNames.

    Static Semantics: Early Errors

    ScriptBody : StatementList
      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.

---*/


$DONOTEVALUATE();

class C {
  [this.#f] = 'Test262'
}