Skip to content

Commit 4dcaa6d

Browse files
authored
Merge pull request #524 from gitKrystan/fix-521
Retain async / generator behavior on class methods (Fixes #521)
2 parents 3405eab + e5285dd commit 4dcaa6d

10 files changed

+56
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const Foo = Test.extend({
2+
myAsyncMethod: async function() {
3+
await Promise.resolve('hello');
4+
}
5+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import classic from 'ember-classic-decorator';
2+
3+
@classic
4+
class Foo extends Test {
5+
async myAsyncMethod() {
6+
await Promise.resolve('hello');
7+
}
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const Foo = Test.extend({
2+
async myAsyncMethod() {
3+
await Promise.resolve('hello');
4+
}
5+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import classic from 'ember-classic-decorator';
2+
3+
@classic
4+
class Foo extends Test {
5+
async myAsyncMethod() {
6+
await Promise.resolve('hello');
7+
}
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const Foo = Test.extend({
2+
*gen() {
3+
yield 'hello';
4+
}
5+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import classic from 'ember-classic-decorator';
2+
3+
@classic
4+
class Foo extends Test {
5+
*gen() {
6+
yield 'hello';
7+
}
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const Foo = Test.extend({
2+
gen: function*() {
3+
yield 'hello';
4+
}
5+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import classic from 'ember-classic-decorator';
2+
3+
@classic
4+
class Foo extends Test {
5+
*gen() {
6+
yield 'hello';
7+
}
8+
}

transforms/helpers/eo-prop/private/function-expression.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export default class EOFunctionExpressionProp extends AbstractEOProp<
5151
body: this.value.body,
5252
comments: this.comments,
5353
decorators: this.existingDecorators,
54+
generator: this.value.generator ?? false,
55+
async: this.value.async ?? false,
5456
}),
5557
this.replaceSuperWithUndefined
5658
);

transforms/helpers/eo-prop/private/method.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export default class EOMethod extends AbstractEOProp<
5454
body: this.body,
5555
comments: this.comments,
5656
decorators: this.existingDecorators,
57+
generator: this.value.generator ?? false,
58+
async: this.value.async ?? false,
5759
}),
5860
this.replaceSuperWithUndefined
5961
);

0 commit comments

Comments
 (0)