-
-
Notifications
You must be signed in to change notification settings - Fork 778
Closed
Labels
Description
Consider the following JS snippet:
let _a, b;
foo.forEach(item => {
[_a, b] = item;
doSomething(b);
});When the AST is viewed on the playground, _a is in the (seemingly) expected node:
However, when I get a reference to _a and iterate through its parents like so:
// here, `reference` is the restructured write on _a (the only reference _a has)
for parent in self.nodes().iter_parents(reference.node_id()) {
println!("{:#?}", parent.kind().debug_name());
}I get this output:
"IdentifierReference(_a)"
"SimpleAssignmentTarget"
"AssignmentTarget"
"AssignmentTarget"
"AssignmentExpression"
"ExpressionStatement"
"FunctionBody"
"ArrowFunctionExpression"
"Argument"
"CallExpression"
"ExpressionStatement"
"Program"