Skip to content

refactor(parser): Remove lexer lookahead in JS let declaration parsing#11308

Merged
Boshen merged 1 commit intooxc-project:mainfrom
therewillbecode:refactor/remove-lexer-lookahead-in-decl
May 27, 2025
Merged

refactor(parser): Remove lexer lookahead in JS let declaration parsing#11308
Boshen merged 1 commit intooxc-project:mainfrom
therewillbecode:refactor/remove-lexer-lookahead-in-decl

Conversation

@therewillbecode
Copy link
Contributor

@therewillbecode therewillbecode commented May 26, 2025

Part of #11194.

Removes usage of lexer lookahead methods in favour of using the parser lookaheads for parsing let declarations.

@graphite-app
Copy link
Contributor

graphite-app bot commented May 26, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-parser Area - Parser C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels May 26, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented May 26, 2025

CodSpeed Instrumentation Performance Report

Merging #11308 will not alter performance

Comparing therewillbecode:refactor/remove-lexer-lookahead-in-decl (05b3e4c) with main (590c27b)

Summary

✅ 38 untouched benchmarks

Copy link
Member

@Boshen Boshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on a hot path, but none of our benchmarks exercise this hot path fully.

Tracking SyntaxKind.LetKeyword I found

            case SyntaxKind.LetKeyword:
                if (isLetDeclaration()) {
                    return parseVariableStatement(getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ undefined);
                }
                break;

So maybe a little refactoring to make the code read better in a follow up PR.

@Boshen Boshen merged commit 44bb9fb into oxc-project:main May 27, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants