Open DonIsaac opened 1 week ago
I would like to remove these "special cases" like ExpressionArrayElement
entirely. As you say, it's confusing, and it complicates our code. If we get rid of it, then you can still figure out if the Expression
you're visiting is an element of an ArrayExpression
or not - just look up the parent.
We need a consensus on visiting these partial expressions. See context https://github.com/oxc-project/oxc/issues/4060
This was also brought up in the confusing partial visit of chain expression.
I also had confusion when visiting assignment targets.
AstKind
has two variants with almost identical names:AstKind::ArrayExpressionElement(_)
which contains anArrayExpressionElement
AstKind::ExpressionArrayElement(_)
which contains anExpression
.From digging around the code, it looks like
ExpressionArrayElement
is visited when anArrayExpressionElement
contains anExpression
Is this intentional? If it is, we should document the difference between the two since it's quite confusing. If not, we should remove one of these in favor of the other.