[hir] Skip only MemberExpressions

Identifiers don't need skipping anyways, so this doesn't affect the existing 
behavior. 

In the future, we will special case handling of LHS of AssignmentExpression 
which will require us to not skip the RHS.
This commit is contained in:
Sathya Gunasekaran
2023-03-03 13:35:03 +00:00
parent f17f4dcf0b
commit 99eb48db07
+8 -5
View File
@@ -2174,13 +2174,16 @@ function gatherCapturedDeps(
return;
}
// For CallExpression, we need to depend on the receiver, not the
// function itself.
if (path.parent.type === "CallExpression" && path.isMemberExpression()) {
path = path.get("object");
if (path.isMemberExpression()) {
// For CallExpression, we need to depend on the receiver, not the
// function itself.
if (path.parent.type === "CallExpression") {
path = path.get("object");
}
path.skip();
}
path.skip();
capturedIds.add(binding.identifier);
capturedRefs.add(lowerExpressionToTemporary(builder, path));
},