Refactor transformer to use the instance of AstBuilder
which is in TraverseCtx
everywhere
#6172
Labels
A-transformer
Area - Transformer / Transpiler
good first issue
Experience Level - Good for newcomers
AstBuilder
is the object which you use to generate AST nodes. It is heavily used in the transformer.We currently have 2 copies of
AstBuilder
in transformer:TransformCtx
TraverseCtx
.This is problematic for 3 reasons:
TransformCtx
intoTraverseCtx
backlog#144, which will be a performance boost.AstBuilder
will become stateful, containing a counter for creating unique IDs. So only a single copy of it can exist.We need to go through the transformer and swap all uses of
AstBuilder
fromTransformCtx
over to use the copy inTraverseCtx
.For example:
oxc/crates/oxc_transformer/src/react/jsx_source.rs
Lines 92 to 96 in 1cee207
Should become:
This will require passing
TraverseCtx
into some functions which it's currently not available in.I have marked this as "good first issue" as it's not too technically tricky (but then again, there are always some unforeseen complications!), but is a good opportunity for anyone interested in the transformer to get to know the codebase.
Would anyone be able to help please?
The text was updated successfully, but these errors were encountered: