Skip to content

fix: do not keep elided call arguments in error recovery - #18604

Merged
JLHwung merged 1 commit into
mainfrom
jlhwung/fix-parser-recovery-elided-call-argument
Nov 12, 2026
Merged

JLHwung merged 1 commit into
mainfrom
jlhwung/fix-parser-recovery-elided-call-argument

Conversation

@JLHwung

@JLHwung JLHwung commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor
Q                       A
Fixed Issues? With errorRecover: true, Babel parser crashes on invalid input import(,) AST Explorer
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
Need backport? 7.x
License MIT

When errorRecovery is true, Babel parser leaves a hole in the elided arguments import(,), which crashes parseImportCall and checkParams.

new f(,) produced arguments: [null], which is also not valid.

The array literal hole [,] is not affected.

Assisted-by: Claude Fable 5.1

@JLHwung
JLHwung added this pull request to stack #18605 November 12, 2026 02:47
@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: parser 7.x: needs backport labels Nov 12, 2026
@babel-bot

babel-bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/63266

@pkg-pr-new

pkg-pr-new Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

commit: 5186afa

Base automatically changed from jlhwung/fix-parser-recovery-assignment-pattern-start to main November 12, 2026 14:27
When errorRecovery is true, Babel parser leaves a hole in the elided arguments `import(,)`, which crashes `parseImportCall` and `checkParams`.

`new f(,)` produced `arguments: [null]`, which is also not valid.

The array literal hole `[,]` is not affected.

Assisted-by: Claude Fable 5.1
@JLHwung
JLHwung force-pushed the jlhwung/fix-parser-recovery-elided-call-argument branch from 92a12b5 to 5186afa Compare November 12, 2026 14:27
@JLHwung
JLHwung added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 02be2d9 Nov 12, 2026
79 of 81 checks passed
@JLHwung
JLHwung deleted the jlhwung/fix-parser-recovery-elided-call-argument branch November 12, 2026 16:52
@babel-bot

Copy link
Copy Markdown
Collaborator

Backported to 7.x in #18611.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants