summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage.js
blob: b981b75d32e7c5594aa3525567f526fb433ac9f6 (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
// |reftest| error:SyntaxError
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-private-environment-on-class-heritage.case
// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
/*---
description: It's a SyntaxError if a class expression evaluated on ClassHeritage uses an undeclared private name. (class declaration)
esid: prod-ClassElement
features: [class-fields-private, class-fields-public, class]
flags: [generated]
negative:
  phase: parse
  type: SyntaxError
info: |
    Runtime Semantics: ClassDefinitionEvaluation

    ClassTail : ClassHeritage { ClassBody }
        ...
        5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context.
        6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
        7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
        8. If ClassBodyopt is present, then
            a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt,
              i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
        9. If ClassHeritageopt is not present, then
            a. Let protoParent be the intrinsic object %ObjectPrototype%.
            b. Let constructorParent be the intrinsic object %FunctionPrototype%.
        10. Else,
            a. Set the running execution context's LexicalEnvironment to classScope.
            b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage.
        ...

---*/


$DONOTEVALUATE();

class C extends class { x = this.#foo; }
{
  #foo;
}