Skip to content

fix(semantic): do not declare a Symbol for an ModuleDeclaration where the id is not a BindingIdentifier#10343

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-10-refactor_semantic_simplify_bind_logic_for_tsmoduledeclaration
Apr 11, 2025
Merged

fix(semantic): do not declare a Symbol for an ModuleDeclaration where the id is not a BindingIdentifier#10343
graphite-app[bot] merged 1 commit intomainfrom
04-10-refactor_semantic_simplify_bind_logic_for_tsmoduledeclaration

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Apr 10, 2025

In previous implementations, a symbol was declared for ModuleDeclaration but only inserted when name was a BindingIdentifier. This is incorrect and also causes a potential performance impact. See https://github.com/oxc-project/oxc/blob/bae53b9606b62fce58b4101497849997b0dc07b3/crates/oxc_semantic/src/stats.rs.

So we should only declare a symbol when its name is a BindingIdentifier because only BindingIdentifier can be inserted with a symbol ID.

@github-actions github-actions bot added A-semantic Area - Semantic A-transformer Area - Transformer / Transpiler C-bug Category - Bug labels Apr 10, 2025
Copy link
Member Author

Dunqing commented Apr 10, 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.

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

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 10, 2025

CodSpeed Instrumentation Performance Report

Merging #10343 will not alter performance

Comparing 04-10-refactor_semantic_simplify_bind_logic_for_tsmoduledeclaration (c37f048) with main (4a6bb21)

Summary

✅ 36 untouched benchmarks

@Dunqing Dunqing force-pushed the 04-10-refactor_semantic_simplify_bind_logic_for_tsmoduledeclaration branch 2 times, most recently from c21148f to 678454b Compare April 10, 2025 10:57
@Dunqing Dunqing force-pushed the 04-10-refactor_semantic_simplify_bind_logic_for_tsmoduledeclaration branch from 678454b to 0a2fed4 Compare April 10, 2025 11:36
@Dunqing Dunqing changed the title fix(semantic): do not declare a symbol for a ModuleDeclaration where the id is not a BindingIdentifier fix(semantic): do not declare a Symbol for an ModuleDeclaration where the id is not a BindingIdentifier Apr 11, 2025
@Dunqing Dunqing marked this pull request as ready for review April 11, 2025 08:04
@Dunqing Dunqing requested a review from Boshen as a code owner April 11, 2025 08:04
@Dunqing Dunqing force-pushed the 04-10-refactor_semantic_simplify_bind_logic_for_tsmoduledeclaration branch from 0a2fed4 to d4bcd57 Compare April 11, 2025 09:45
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Apr 11, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Apr 11, 2025

Merge activity

…here the `id` is not a `BindingIdentifier` (#10343)

In previous implementations, a symbol was declared for `ModuleDeclaration` but only inserted when `name` was a `BindingIdentifier`. This is incorrect and also causes a potential performance impact. See https://github.com/oxc-project/oxc/blob/bae53b9606b62fce58b4101497849997b0dc07b3/crates/oxc_semantic/src/stats.rs.

So we should only declare a symbol when its name is a `BindingIdentifier` because only `BindingIdentifier` can be inserted with a symbol ID.
@graphite-app graphite-app bot force-pushed the 04-10-refactor_semantic_simplify_bind_logic_for_tsmoduledeclaration branch from d4bcd57 to c37f048 Compare April 11, 2025 09:58
@graphite-app graphite-app bot merged commit c37f048 into main Apr 11, 2025
30 checks passed
@graphite-app graphite-app bot deleted the 04-10-refactor_semantic_simplify_bind_logic_for_tsmoduledeclaration branch April 11, 2025 10:11
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Apr 11, 2025
@Boshen Boshen mentioned this pull request Apr 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-semantic Area - Semantic A-transformer Area - Transformer / Transpiler C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant