summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/class/elements/class-name-static-initializer-expr.js
blob: 18e743e2bff08ac9c5751a784baf11c93dccf1a4 (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
// Copyright 2019 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
    The class-name is present when executing static field initializers of named class expressions.
info: |
    14.6.13 Runtime Semantics: ClassDefinitionEvaluation

    [...]
    17. Perform MakeClassConstructor(F).
    18. If className is not undefined, then
        a. Perform SetFunctionName(F, className).
    [...]

features: [class-static-fields-public]
---*/

var className;

var expr = class C {
    static f = (className = this.name);
}

assert.sameValue(className, "C");

reportCompare(0, 0);