swc/crates/swc_ecma_parser/tests/tsc/privateNameStaticFieldCallExpression.ts

22 lines
554 B
TypeScript
Raw Normal View History

// @target: es2015
class A {
static #fieldFunc = function () { this.x = 10; };
static #fieldFunc2 = function (a, ...b) {};
x = 1;
test() {
A.#fieldFunc();
A.#fieldFunc?.();
const func = A.#fieldFunc;
func();
new A.#fieldFunc();
const arr = [ 1, 2 ];
A.#fieldFunc2(0, ...arr, 3);
const b = new A.#fieldFunc2(0, ...arr, 3);
const str = A.#fieldFunc2`head${1}middle${2}tail`;
this.getClass().#fieldFunc2`test${1}and${2}`;
}
getClass() { return A; }
}