Skip to content

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Aug 19, 2025

fixes #13205
closes #13206

Copilot AI review requested due to automatic review settings August 19, 2025 08:19
@Boshen Boshen changed the title fix(parser): produce syntax error for export enum and similar ts syntaxes` fix(parser): produce syntax error for export enum and similar ts syntaxes Aug 19, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 19, 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-bug Category - Bug labels Aug 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the parser to properly handle TypeScript-specific syntax like export enum, export interface, and similar constructs by adding TypeScript context checks and reorganizing the declaration parsing logic.

  • Moves variable declaration parsing to handle var, let, and const first
  • Adds self.is_ts checks to TypeScript-specific declaration types to prevent parsing them in JavaScript contexts
  • Removes the unused is_variable_declaration() helper method

Reviewed Changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_parser/src/ts/statement.rs Reorganizes declaration parsing logic and adds TypeScript context checks
crates/oxc_parser/src/lexer/kind.rs Removes unused is_variable_declaration() helper method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 19, 2025

CodSpeed Instrumentation Performance Report

Merging #13208 will not alter performance

Comparing 08-19-fix_parser_produce_syntax_error_for_export_enum_and_similar_ts_syntaxes (7970f8e) with main (51ca0ad)1

Summary

✅ 34 untouched benchmarks

Footnotes

  1. No successful run was found on main (63abd7c) during the generation of this report, so 51ca0ad was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Boshen Boshen merged commit ade2ccb into main Aug 19, 2025
27 checks passed
@Boshen Boshen deleted the 08-19-fix_parser_produce_syntax_error_for_export_enum_and_similar_ts_syntaxes branch August 19, 2025 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parser: export enum a {} is not rejected for lang=js

2 participants