Debian Codegraph @

packages/babel-plugin-proposal-class-properties/test/fixtures/regression/7371/output.js

raw
1 "use strict";
2
3 class C {}
4 class A extends C {
5 constructor() {
6 super();
7 babelHelpers.defineProperty(this, "field", 1);
8 class B extends C {
9 constructor() {
10 super();
11 expect(this.field).toBeUndefined();
12 }
13 }
14 expect(this.field).toBe(1);
15 new B();
16 }
17 }
18 new A();
19 class Obj {
20 constructor() {
21 return {};
22 }
23 }
24
25 // ensure superClass is still transformed
26 class SuperClass extends Obj {
27 constructor() {
28 class B extends ((super(), babelHelpers.defineProperty(this, "field", 1)), Obj) {
29 constructor() {
30 super();
31 expect(this.field).toBeUndefined();
32 }
33 }
34 expect(this.field).toBe(1);
35 new B();
36 }
37 }
38 new SuperClass();
39
40 // ensure ComputedKey Method is still transformed
41 class ComputedMethod extends Obj {
42 constructor() {
43 class B extends Obj {
44 constructor() {
45 super();
46 expect(this.field).toBeUndefined();
47 }
48 [(super(), babelHelpers.defineProperty(this, "field", 1), this)]() {}
49 }
50 expect(this.field).toBe(1);
51 new B();
52 }
53 }
54 new ComputedMethod();
55
56 // ensure ComputedKey Field is still transformed
57 class ComputedField extends Obj {
58 constructor() {
59 let _ref;
60 _ref = (super(), babelHelpers.defineProperty(this, "field", 1), this);
61 class B extends Obj {
62 constructor() {
63 super();
64 babelHelpers.defineProperty(this, _ref, 1);
65 expect(this.field).toBeUndefined();
66 }
67 }
68 expect(this.field).toBe(1);
69 new B();
70 }
71 }
72 new ComputedField();