Skip to content

refactor(codegen): accept SymbolTable instead of Mangler#8829

Merged
Boshen merged 1 commit intooxc-project:mainfrom
danbulant:main
Feb 2, 2025
Merged

refactor(codegen): accept SymbolTable instead of Mangler#8829
Boshen merged 1 commit intooxc-project:mainfrom
danbulant:main

Conversation

@danbulant
Copy link
Contributor

It seems to be that the easiest way to rename variables is to use rename_symbol from SymbolTable and to let it be applied during codegen - this is what Mangler does.

This PR changes Codegen to accept (any) SymbolTable instead of just Mangler itself, and for Mangler build output to be a new SymbolTable, after consuming itself (which makes it clear at the type level if a Mangler has been built or not).

This also moves the few symbol table helper methods from Mangler to SymbolTable itself, and adds an example of Mangler use to it's documentation.

Codegen dependencies now include semantic (which was transient by mangler before). It's dependency on Mangler could be removed, though I've left it to allow easy linking of docs (with_symbol_table points users to Mangler, hopefully helps with migration?)

@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 1, 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-semantic Area - Semantic A-minifier Area - Minifier A-codegen Area - Code Generation C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Feb 1, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 2, 2025

CodSpeed Performance Report

Merging #8829 will not alter performance

Comparing danbulant:main (26840a8) with main (831928d)

Summary

✅ 33 untouched benchmarks

@Boshen Boshen merged commit 6aa2dde into oxc-project:main Feb 2, 2025
25 checks passed
@oxc-bot oxc-bot mentioned this pull request Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation A-minifier Area - Minifier A-semantic Area - Semantic 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.

2 participants