mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
Close #5488. `generate_uid` previously iterated through every symbol and unresolved reference in the AST to find a unique var name. If the first var name it tried was already in use, it'd iterate again. Instead build a hash map recording existing var names in use for every name which could clash with a UID (any var name starting with `_`). Once built, use that hash map to generate UIDs without iterating through all symbols again. I had hoped to make `generate_uid` cheaper still by just recording the highest digits postfix for each var name, and then incrementing that postfix for each UID. i.e. if AST contains vars `_foo1` and `_foo6`, create UIDs starting at one number higher - `_foo7`, `_foo8` etc. This method would be more efficient, but unfortunately it does not match Babel, and so causes some of Babel's tests to fail. |
||
|---|---|---|
| .. | ||
| oxc | ||
| oxc_allocator | ||
| oxc_ast | ||
| oxc_ast_macros | ||
| oxc_cfg | ||
| oxc_codegen | ||
| oxc_diagnostics | ||
| oxc_index | ||
| oxc_isolated_declarations | ||
| oxc_language_server | ||
| oxc_linter | ||
| oxc_macros | ||
| oxc_mangler | ||
| oxc_minifier | ||
| oxc_module_lexer | ||
| oxc_parser | ||
| oxc_prettier | ||
| oxc_regular_expression | ||
| oxc_semantic | ||
| oxc_sourcemap | ||
| oxc_span | ||
| oxc_syntax | ||
| oxc_transformer | ||
| oxc_traverse | ||
| oxc_wasm | ||