Fixup class names in class decorator private identifier tests.

For the statement level test, the inner class name is not initialized
at the time the decorators evaluate, resulting in a ReferenceError
that the declaration can not be accessed prior to initialization.

Similar, non-decorator code, like:
    class C {
        static dec() {}
        static {
            this.x = C.dec();
            class C {}
        }
    }
also results in a ReferenceError.

For the expression level test, the var C is undefined at the time the
decorators are evaluated, resulting in TypeError while trying to access
a member of undefined.

Similar, non-decorator code, like:
    var C = class {
        static f() {};
        static {
            this.x = C.f();
        }
    }
also results in a TypeError.
This commit is contained in:
Daniel Minor 2023-08-30 12:16:54 -04:00 committed by Philip Chimento
parent dceb204259
commit 581de2d0f8
2 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ info: |
---*/
var C = class {
class C {
static #$() {}
static #_() {}
static #\u{6F}() {}
@ -43,7 +43,7 @@ var C = class {
static #await() {}
static {
var C = @C.#$
var D = @C.#$
@C.#_
@C.#\u{6F}
@C.#\u2118

View File

@ -51,6 +51,6 @@ class C {
@C.#ZW_\u200C_NJ
@C.#ZW_\u200D_J
@C.#yield
@C.#await class C {}
@C.#await class D {}
}
}