ComputedMemberExpression node is missing.
JasithC opened this issue · comments
ComputedMemberExpression
can be an Expression
, but in this position it isn't.
The left side of an AssignmentExpression
is an AssignmentTarget
:
oxc/crates/oxc_ast/src/ast/js.rs
Lines 701 to 706 in e0646d7
And AssignmentTarget
is either a SimpleAssignmentTarget
or a AssignmentTargetPattern
:
oxc/crates/oxc_ast/src/ast/js.rs
Lines 718 to 723 in e0646d7
SimpleAssignmentTarget
can be a MemberExpression
:
oxc/crates/oxc_ast/src/ast/js.rs
Lines 735 to 744 in e0646d7
And (finally!) MemberExpression
can be a ComputedMemberExpression
:
oxc/crates/oxc_ast/src/ast/js.rs
Lines 462 to 469 in e0646d7
So... to visit the ComputedMemberExpression
in this position, use one of:
enter_computed_member_expression
enter_member_expression
enter_simple_assignment_target
enter_assignment_target
Which is the best choice depends on what you want to do with the node (replace it with what?) and what other nodes are you interested in (do you also want to visit e.g. StaticMemberExpression
?)
Note: The @inherits
syntax is not standard Rust - it's a (somewhat ugly) extension we've created ourselves. You can read about "enum inheritance" here: https://docs.rs/oxc_ast/latest/oxc_ast/ast/index.html
Closing because I don't believe this to be a bug (though I understand why you thought it was - it's not obvious).