Open overlookmotel opened 3 months ago
It would be preferable to do this check by reading up AST in enter_boolean_literal instead.
This sounds like a huge performance regression. It needs to check for every bool
...
I'm not sure which is worse - checking every bool, or checking every function call! Either way, it's going to be cheap in majority of cases because of the ctx.ancestors_depth()
check - that's a very quick check, so it'll bail out early in most cases without doing any work.
Broken out from oxc-project/backlog#128:
We've hit a case where the following APIs in
Traverse
visitors would be useful:Vec
.Vec
.Minifier (#4725) needs to check when visiting a
BooleanExpression
whether it istrue
in:Currently this is implemented by checking when entering a
CallExpression
whether it matches this pattern and setting a flag if so. It would be preferable to do this check by reading up AST inenter_boolean_literal
instead.This isn't currently possible as cannot access
call_expr.arguments
. It would be safe to access other elements inarguments
except for the current one, but this is not supported currently byTraverse
's API.