-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transformer: re-walk transformed nodes in exit_*
methods
#5381
Comments
Argh! This is exactly what I was hoping we could avoid! I was hoping we could avoid it by standardizing the order transforms execute in, so clashes become impossible/much less likely. This is kind of what I was getting at when I was talking the other week about adding But, yes, I agree we do have a problem here and we'll need a solution (of some kind). In practice, do we have any transforms which aren't working at present because of this problem? |
I am following up on #5366 to remove the duplicate logic in oxc/crates/oxc_transformer/src/react/refresh.rs Lines 578 to 605 in 8d565d5
However, there is a problem: we added fallback logic in I hope I have explained it clearly. Nevertheless, in this scenario, we can resolve it by putting the logic into a utility function. This way, we can simply call the function when encountering the aforementioned case. |
Why do we need this?
Sometimes we may need the ability to re-walk transformed nodes in
exit_*
methods.For example, when we transform
Expression::ArrowFunctionExpression
toExpression::CallExpression
inexit_expression
. The newCallExpression
may contain some nodes that must be transformed.Rough draft
The implementation that I thought looks like this:
Now we only missing
walk_xxxxx
APII can imagine that this might be quite complex to implement. 🤔
Disadvantages
This can also cause a serious impact, we may need to cache the already transformed nodes within the plugin to avoid re-transform them during a re-walk.
The text was updated successfully, but these errors were encountered: