forked from babel/babel
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for yield/await in class decorators
NOTE: This doesn't work for decorators inside the class body, like in babel#8300
- Loading branch information
1 parent
994b9f1
commit 07e2e82
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...in-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/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,5 @@ | ||
async function* f() { | ||
@(yield dec1) | ||
@(await dec2) | ||
class A {} | ||
} |
3 changes: 3 additions & 0 deletions
3
...roposal-decorators/test/fixtures/transformation/class-decorators-yield-await/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,3 @@ | ||
{ | ||
"plugins": ["proposal-decorators", "proposal-class-properties", "external-helpers", "syntax-async-generators"] | ||
} |
17 changes: 17 additions & 0 deletions
17
...n-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/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,17 @@ | ||
async function* f() { | ||
let A = babelHelpers.decorate([yield dec1, await dec2], function (_initialize) { | ||
"use strict"; | ||
|
||
class A { | ||
constructor() { | ||
_initialize(this); | ||
} | ||
|
||
} | ||
|
||
return { | ||
F: A, | ||
d: [] | ||
}; | ||
}); | ||
} |