TypeScript/tests/baselines/reference/thisAndSuperInStaticMembers1(target=esnext).js
Wenlu Wang dc237b317e
Change static fields emits (#43114)
* use emit into iife

* Update emit

* Revert un-related changes

* Allow super in static context

* Allow this and super in static property declaration

* Add more tests

* Avoid errors

* Accept baseline

* Accept baseline

* Add decorated classes test

* Add errors

* Avoid this in emitter

* make lint happy

* Add class expression tests

* Add computed name test

* Avoid super if target below es6

* Adjust function boundary

* Add internal

* Fix minor CR issues

* accept baseline

* Update behavior

* Avoid spaces

* Make lint happy

* Avoid function boundary utils

* Update baseline

* Avoid errors

* Accept baseline

* Accept baseline

* Accept baseline

* Accept baseline

* Use substitutions

* Full coverage for super, this, merge static and private context

* Fix use-before-def in static fields

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 15:49:27 -07:00

72 lines
1.9 KiB
TypeScript

//// [thisAndSuperInStaticMembers1.ts]
declare class B {
static a: any;
static f(): number;
a: number;
f(): number;
}
class C extends B {
static x: any = undefined!;
static y1 = this.x;
static y2 = this.x();
static y3 = this?.x();
static y4 = this[("x")]();
static y5 = this?.[("x")]();
static z1 = super.a;
static z2 = super["a"];
static z3 = super.f();
static z4 = super["f"]();
static z5 = super.a = 0;
static z6 = super.a += 1;
static z7 = (() => { super.a = 0; })();
static z8 = [super.a] = [0];
static z9 = [super.a = 0] = [0];
static z10 = [...super.a] = [0];
static z11 = { x: super.a } = { x: 0 };
static z12 = { x: super.a = 0 } = { x: 0 };
static z13 = { ...super.a } = { x: 0 };
static z14 = ++super.a;
static z15 = --super.a;
static z16 = ++super[("a")];
static z17 = super.a++;
static z18 = super.a``;
// these should be unaffected
x = 1;
y = this.x;
z = super.f();
}
//// [thisAndSuperInStaticMembers1.js]
class C extends B {
static x = undefined;
static y1 = this.x;
static y2 = this.x();
static y3 = this?.x();
static y4 = this[("x")]();
static y5 = this?.[("x")]();
static z1 = super.a;
static z2 = super["a"];
static z3 = super.f();
static z4 = super["f"]();
static z5 = super.a = 0;
static z6 = super.a += 1;
static z7 = (() => { super.a = 0; })();
static z8 = [super.a] = [0];
static z9 = [super.a = 0] = [0];
static z10 = [...super.a] = [0];
static z11 = { x: super.a } = { x: 0 };
static z12 = { x: super.a = 0 } = { x: 0 };
static z13 = { ...super.a } = { x: 0 };
static z14 = ++super.a;
static z15 = --super.a;
static z16 = ++super[("a")];
static z17 = super.a++;
static z18 = super.a ``;
// these should be unaffected
x = 1;
y = this.x;
z = super.f();
}