[hir] Handle LHS of AssignmentExpression specially

Babel has a bug where it doesn't visit the LHS of an AssignmentExpression if 
it's an Identifier. Work around it by explicitly visiting it.
This commit is contained in:
Sathya Gunasekaran
2023-03-03 13:35:04 +00:00
parent 482ae7aa7c
commit 1e5e75746d
+11
View File
@@ -2160,6 +2160,17 @@ function gatherCapturedDeps(
});
function visit(path: NodePath<Expression>): void {
// Babel has a bug where it doesn't visit the LHS of an
// AssignmentExpression if it's an Identifier. Work around it by explicitly
// visiting it.
if (path.isAssignmentExpression()) {
const left = path.get("left");
if (left.isIdentifier()) {
visit(left);
}
return;
}
let obj = path;
while (obj.isMemberExpression()) {
obj = obj.get("object");