Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[decorators] Support async and generator methods (#8742)
- Loading branch information
1 parent
a19b72e
commit af694eb
Showing
4 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...l-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@decorator | ||
class Foo { | ||
async f1() {} | ||
|
||
*f2() {} | ||
|
||
async *f3() {} | ||
} |
8 changes: 8 additions & 0 deletions
8
...ugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"plugins": [ | ||
["proposal-decorators", { "decoratorsBeforeExport": false }], | ||
"proposal-class-properties", | ||
"syntax-async-generators", | ||
["external-helpers", { "helperVersion": "7.0.2" }] | ||
] | ||
} |
33 changes: 33 additions & 0 deletions
33
...-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
let Foo = babelHelpers.decorate([decorator], function (_initialize) { | ||
"use strict"; | ||
|
||
class Foo { | ||
constructor() { | ||
_initialize(this); | ||
} | ||
|
||
} | ||
|
||
return { | ||
F: Foo, | ||
d: [{ | ||
kind: "method", | ||
key: "f1", | ||
|
||
async value() {} | ||
|
||
}, { | ||
kind: "method", | ||
key: "f2", | ||
|
||
*value() {} | ||
|
||
}, { | ||
kind: "method", | ||
key: "f3", | ||
|
||
async *value() {} | ||
|
||
}] | ||
}; | ||
}); |