[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.
Sathya Gunasekaran committed
Mar 3, 2023 at 13:35 UTC
99eb48db07575efd6acc725ac3ac9e321f4bd9be
1 file changed
+8
-5
compiler/forget/src/HIR/BuildHIR.ts
+8
-5
@@ -2174,13 +2174,16 @@ function gatherCapturedDeps(
2174
return;
2175
}
2176
2177
- // For CallExpression, we need to depend on the receiver, not the
2178
- // function itself.
2179
- if (path.parent.type === "CallExpression" && path.isMemberExpression()) {
2180
- path = path.get("object");
2177
+ if (path.isMemberExpression()) {
2178
+ // For CallExpression, we need to depend on the receiver, not the
2179
+ // function itself.
2180
+ if (path.parent.type === "CallExpression") {
2181
+ path = path.get("object");
2182
+ }
2183
+
2184
+ path.skip();
2185
}
2186
2183
- path.skip();
2187
capturedIds.add(binding.identifier);
2188
capturedRefs.add(lowerExpressionToTemporary(builder, path));
2189
},