Skip to content

Commit 4739afc

Browse files
committed
Extend tests to cover arrow functions with expression body
1 parent 9002fe0 commit 4739afc

File tree

6 files changed

+92
-0
lines changed

6 files changed

+92
-0
lines changed

tasks/transform_conformance/tests/babel-plugin-transform-async-to-generator/test/fixtures/class/this-after-super-nested/input.js

+18
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,21 @@ class Outer {
1515
}
1616
}
1717
}
18+
19+
class Outer2 {
20+
constructor() {
21+
async () => [this, 4];
22+
23+
class Inner extends Outer2 {
24+
constructor() {
25+
if (condition) {
26+
const _super = super();
27+
this.fn = async () => [this, 5];
28+
}
29+
30+
super();
31+
async () => [this, 6];
32+
}
33+
}
34+
}
35+
}

tasks/transform_conformance/tests/babel-plugin-transform-async-to-generator/test/fixtures/class/this-after-super-nested/output.js

+28
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,31 @@ class Outer {
2525
}
2626
}
2727
}
28+
29+
class Outer2 {
30+
constructor() {
31+
var _this3 = this;
32+
babelHelpers.asyncToGenerator(function* () {
33+
return [_this3, 4];
34+
});
35+
36+
class Inner extends Outer2 {
37+
constructor() {
38+
var _this4;
39+
40+
if (condition) {
41+
const _super = (super(), _this4 = this);
42+
this.fn = babelHelpers.asyncToGenerator(function* () {
43+
return [_this4, 5];
44+
});
45+
}
46+
47+
super();
48+
_this4 = this;
49+
babelHelpers.asyncToGenerator(function* () {
50+
return [_this4, 6];
51+
});
52+
}
53+
}
54+
}
55+
}

tasks/transform_conformance/tests/babel-plugin-transform-async-to-generator/test/fixtures/class/this-after-super-with-async-arrow-function/input.js

+6
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ class C extends S {
77
});
88
}
99
}
10+
11+
class C2 extends S {
12+
constructor() {
13+
super(async () => this);
14+
}
15+
}

tasks/transform_conformance/tests/babel-plugin-transform-async-to-generator/test/fixtures/class/this-after-super-with-async-arrow-function/output.js

+10
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@ class C extends S {
99
_this = this;
1010
}
1111
}
12+
13+
class C2 extends S {
14+
constructor() {
15+
var _this2;
16+
super(babelHelpers.asyncToGenerator(function* () {
17+
return _this2;
18+
}));
19+
_this2 = this;
20+
}
21+
}

tasks/transform_conformance/tests/babel-plugin-transform-async-to-generator/test/fixtures/class/this-after-super/input.js

+12
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,15 @@ class C extends S {
1111
async () => { return [this, 2]; };
1212
}
1313
}
14+
15+
class C2 extends S {
16+
constructor() {
17+
if (true) {
18+
const _super = super();
19+
this.fn = async () => [this, 1];
20+
}
21+
22+
super();
23+
async () => [this, 2];
24+
}
25+
}

tasks/transform_conformance/tests/babel-plugin-transform-async-to-generator/test/fixtures/class/this-after-super/output.js

+18
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,21 @@ class C extends S {
1717
});
1818
}
1919
}
20+
21+
class C2 extends S {
22+
constructor() {
23+
var _this2;
24+
if (true) {
25+
const _super = (super(), _this2 = this);
26+
this.fn = babelHelpers.asyncToGenerator(function* () {
27+
return [_this2, 1];
28+
});
29+
}
30+
31+
super();
32+
_this2 = this;
33+
babelHelpers.asyncToGenerator(function* () {
34+
return [_this2, 2];
35+
});
36+
}
37+
}

0 commit comments

Comments
 (0)