[Transpiling] Rest parameters with async bug
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- build-system
Research direction
Start by reproducing the minimal JavaScript case and comparing the generated output with the reported expectation. Trace the async and rest-parameter transpilation, especially how inlining affects the scope used for arguments; done means the generated _arguments2 reference is captured from the outer function rather than the nested callback.
Written by the indexing model from the issue text.
Description
Minimal test case:
export const brokenArgsRest = async (...props) => {
await someAsyncFunction(async () => {
console.log(props)
})
}
export const someAsyncFunction = async callback => {
await callback()
}
generates
var brokenArgsRest = function brokenArgsRest() {
return Promise.resolve(someAsyncFunction(function () {
try {
var _arguments2 = arguments;
console.log([].slice.call(_arguments2));
return Promise.resolve();
} catch (e) {
return Promise.reject(e);
}
})).then(function () {});
};
var someAsyncFunction = function someAsyncFunction(callback) {
try {
return Promise.resolve(callback()).then(function () {});
} catch (e) {
return Promise.reject(e);
}
};
var _arguments2 = arguments; should be one more level up
Context:
We hit this bug on fcl-js lib : https://github.com/onflow/flow-js-testing/issues/182
PS: my js knowledge is limited, but seems related to inlining somehow.
- Dominant language
- JavaScript
- Stars
- 8.1k
- Forks
- 358
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from developit/microbundle
-
CSS
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
developit/microbundle#1002 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
developit/microbundle#789 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
developit/microbundle#1100 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
developit/microbundle#1094 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
developit/microbundle#1093 · 3 comments · 1 reaction ·
All issues in developit/microbundle
Similar issues
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·