Skip to content

fix(emitter): preserve parentheses around arrow function object literal body#47

Merged
Brooooooklyn merged 1 commit intomainfrom
fix/arrow-function-object-literal-parens
Mar 3, 2026
Merged

fix(emitter): preserve parentheses around arrow function object literal body#47
Brooooooklyn merged 1 commit intomainfrom
fix/arrow-function-object-literal-parens

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Mar 3, 2026

When user code like () => ({ key: val }) was parsed by OXC, the object
literal was wrapped in a ParenthesizedExpression, converting to
Parenthesized(LiteralMap(...)) in the output AST. The emitter's arrow
function body check only matched direct LiteralMap, missing the wrapped
case and emitting () => { key: val } (a block with a label) instead.

Fix by unwrapping one level of Parenthesized before checking for
LiteralMap in the arrow function body emission.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Note

Cursor Bugbot is generating a summary for commit 06d9e25. Configure here.

…al body

When user code like `() => ({ key: val })` was parsed by OXC, the object
literal was wrapped in a ParenthesizedExpression, converting to
`Parenthesized(LiteralMap(...))` in the output AST. The emitter's arrow
function body check only matched direct `LiteralMap`, missing the wrapped
case and emitting `() => { key: val }` (a block with a label) instead.

Fix by unwrapping one level of `Parenthesized` before checking for
`LiteralMap` in the arrow function body emission.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Brooooooklyn Brooooooklyn merged commit e4c6212 into main Mar 3, 2026
4 checks passed
@Brooooooklyn Brooooooklyn deleted the fix/arrow-function-object-literal-parens branch March 3, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OXC incorrectly removes parentheses around arrow function object literal in Angular output

1 participant