{{ message }}
Fix nested paren arrow bodies in Live Debugger#405
Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intoJun 10, 2026
Conversation
Live Debugger converts arrow expression bodies into block bodies before injecting capture logic. Babel reports nested parenthesized bodies like `() => ((1))` as the inner expression range. Remove all wrapper parens around that range so the injected block body remains syntactically valid. Add regression coverage for scalar and object expression bodies wrapped in nested parentheses.
Contributor
Author
yoannmoinet
approved these changes
Jun 10, 2026
Contributor
Author
|
/merge |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What and why?
Fix Live Debugger instrumentation for arrow expression bodies wrapped in multiple parentheses. Babel exposes the unwrapped expression range for these bodies, so the previous paren-stripping logic could leave wrapper parens around the injected block and generate invalid JavaScript.
Input examples that now transform correctly:
Before this fix,
const getNumber = () => ((1));could be transformed into invalid syntax shaped like this:The injected block was left inside a parenthesized expression, so the first
constcaused a syntax error.After this fix, the same input is still instrumented and produces a valid block-bodied arrow function shaped like this:
Single-wrapper cases such as
() => (1)and() => ({a: 1})already worked and continue to work.How?
Remove every wrapper paren found between Babel's recorded arrow body range and the containing arrow function end before injecting the block body. Added regression tests covering nested parenthesized scalar and object expression bodies, and verified with
yarn test:unit packages/plugins/live-debugger/src/transform/index.test.ts.