oxc/crates
overlookmotel d4371e8f95
fix(transformer): use UIDs in TS namespace transforms (#3395)
Use the `TraverseCtx::generate_uid` method introduced in #3395 to fix
some of the TS namespace test cases.

But... I honestly have no idea what I'm doing here!

I am running up against a combination of 3 different areas where I know
very little:

1. I am unfamiliar with `Semantic`.
2. I am unfamiliar with Oxc's conventions for writing transforms.
3. I don't "speak" Typescript!

This PR should not be merged as is. I'm pretty sure it's wrong. I've
done it mostly just to test out `generate_uid`.

In particular:

1. Is `SymbolFlags::FunctionScopedVariable` the right flags to use in
all cases here?
2. `generate_uid` creates a symbol, and registers a binding for it in
the scope tree. So if there are any branches in this logic where `name`
doesn't actually get used after `generate_uid` is called, then it's not
right.
3. Identifiers which are added to AST should also have corresponding
`ReferenceId`s created for them (but I imagine this is also missing in
many other places in the transformer).

On point 2: We could split up `generate_uid` into 2 functions. One
function would find a valid UID name *but not register a binding for
it*. If you want to actually use that name, you'd call a 2nd function to
generate the binding. Would that be a better API?

Could someone help me out to progress this please?

(Sorry my lack of knowledge is a bit useless here. I will learn all
these things in time, but just trying to be honest about where I'm at
right now. I'm sure I could figure it out myself, but it would take me
hours, whereas others will probably look at it and know what to do in
about 5 mins.)
2024-05-27 08:53:13 +08:00
..
oxc Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_allocator Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_ast Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_ast_macros Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_codegen Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_diagnostics Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_index Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_js_regex refactor: rename CompactString to CompactStr (#2619) 2024-03-06 12:24:23 +08:00
oxc_language_server fix: fix some nightly warnings 2024-05-19 00:54:52 +08:00
oxc_linter fix(website): hack schemars to render code snippet in markdown (#3417) 2024-05-26 10:36:53 +00:00
oxc_macros refactor(macros): remove the redundant trie builder (#3415) 2024-05-26 08:00:05 +00:00
oxc_minifier Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_module_lexer Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_parser fix(parser): fix lexer error while parsing parenthesized arrow expressions (#3400) 2024-05-24 09:59:17 +00:00
oxc_prettier fix(parser): correctly parse cls.fn<C> = x (#3208) 2024-05-09 10:23:45 +08:00
oxc_semantic fix(transformer): use UIDs in TS namespace transforms (#3395) 2024-05-27 08:53:13 +08:00
oxc_sourcemap chore(sourcemap): make JSONSourceMap fileds public (#3385) 2024-05-22 20:15:24 +08:00
oxc_span Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_syntax Release crates v0.13.1 2024-05-22 16:50:30 +08:00
oxc_transformer fix(transformer): use UIDs in TS namespace transforms (#3395) 2024-05-27 08:53:13 +08:00
oxc_traverse feat(transformer): add TraverseCtx::generate_uid (#3394) 2024-05-24 17:19:02 +08:00
oxc_wasm chore: update toml format 2024-05-21 22:15:47 +08:00