From 99eb48db07575efd6acc725ac3ac9e321f4bd9be Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Fri, 3 Mar 2023 13:35:03 +0000 Subject: [PATCH] [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. --- compiler/forget/src/HIR/BuildHIR.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler/forget/src/HIR/BuildHIR.ts b/compiler/forget/src/HIR/BuildHIR.ts index bc323517ed..1b02f6d368 100644 --- a/compiler/forget/src/HIR/BuildHIR.ts +++ b/compiler/forget/src/HIR/BuildHIR.ts @@ -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)); },