-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transformer/async-to-generator): incorrect transform when super e…
…xpression is inside async method
- Loading branch information
Showing
9 changed files
with
457 additions
and
71 deletions.
There are no files selected for viewing
457 changes: 403 additions & 54 deletions
457
crates/oxc_transformer/src/common/arrow_function_converter.rs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
mod async_generator_functions; | ||
pub(crate) mod async_generator_functions; | ||
mod object_rest_spread; | ||
mod options; | ||
|
||
|
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
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
10 changes: 10 additions & 0 deletions
10
...mance/tests/babel-plugin-transform-async-to-generator/test/fixtures/super/assign/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,10 @@ | ||
const Obj = { | ||
value: 0, | ||
async method() { | ||
super.value = true; | ||
() => { | ||
super['value'] = true; | ||
super.object.value = true; | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ance/tests/babel-plugin-transform-async-to-generator/test/fixtures/super/assign/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,15 @@ | ||
const Obj = { | ||
value: 0, | ||
method() { | ||
var _superprop_getObject = () => super.object, | ||
_superprop_set = (_prop, _value) => super[_prop] = _value, | ||
_superprop_setValue = _value2 => super.value = _value2; | ||
return babelHelpers.asyncToGenerator(function* () { | ||
_superprop_setValue(true); | ||
() => { | ||
_superprop_set('value', true); | ||
_superprop_getObject().value = true; | ||
}; | ||
})(); | ||
} | ||
}; |
9 changes: 9 additions & 0 deletions
9
...ts/babel-plugin-transform-async-to-generator/test/fixtures/super/computed-member/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,9 @@ | ||
class Foo extends class {} { | ||
async method() { | ||
super['name']; | ||
{ | ||
super['name'](); | ||
super['object']['name'](); | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...s/babel-plugin-transform-async-to-generator/test/fixtures/super/computed-member/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,13 @@ | ||
class Foo extends class {} { | ||
method() { | ||
var _superprop_get = _prop => super[_prop], | ||
_this = this; | ||
return babelHelpers.asyncToGenerator(function* () { | ||
_superprop_get('name'); | ||
{ | ||
_superprop_get('name').call(_this); | ||
_superprop_get('object')['name'](); | ||
} | ||
})(); | ||
} | ||
} |