From 638e45c9280861e7a59d4e18d258330acdb4876b Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Thu, 8 Jun 2023 14:02:02 -0400 Subject: [PATCH] EnterSSA traverses function expressions --- .../src/Inference/AnalyseFunctions.ts | 3 +-- .../packages/babel-plugin-react-forget/src/SSA/EnterSSA.ts | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/forget/packages/babel-plugin-react-forget/src/Inference/AnalyseFunctions.ts b/compiler/forget/packages/babel-plugin-react-forget/src/Inference/AnalyseFunctions.ts index 241d259aa5..bf6835db1a 100644 --- a/compiler/forget/packages/babel-plugin-react-forget/src/Inference/AnalyseFunctions.ts +++ b/compiler/forget/packages/babel-plugin-react-forget/src/Inference/AnalyseFunctions.ts @@ -17,7 +17,7 @@ import { ReactiveScopeDependency, } from "../HIR"; import { constantPropagation } from "../Optimization"; -import { eliminateRedundantPhi, enterSSA } from "../SSA"; +import { eliminateRedundantPhi } from "../SSA"; import { inferTypes } from "../TypeInference"; import { logHIRFunction } from "../Utils/logger"; import { inferMutableRanges } from "./InferMutableRanges"; @@ -89,7 +89,6 @@ export default function analyseFunctions(func: HIRFunction): void { } function lower(func: HIRFunction): void { - enterSSA(func); eliminateRedundantPhi(func); constantPropagation(func); inferTypes(func); diff --git a/compiler/forget/packages/babel-plugin-react-forget/src/SSA/EnterSSA.ts b/compiler/forget/packages/babel-plugin-react-forget/src/SSA/EnterSSA.ts index 4e78c359a8..37020eb4dd 100644 --- a/compiler/forget/packages/babel-plugin-react-forget/src/SSA/EnterSSA.ts +++ b/compiler/forget/packages/babel-plugin-react-forget/src/SSA/EnterSSA.ts @@ -232,6 +232,10 @@ export default function enterSSA(func: HIRFunction): void { for (const instr of block.instructions) { mapInstructionLValues(instr, (lvalue) => builder.definePlace(lvalue)); mapInstructionOperands(instr, (place) => builder.getPlace(place)); + + if (instr.value.kind === "FunctionExpression") { + enterSSA(instr.value.loweredFunc); + } } mapTerminalOperands(block.terminal, (place) => builder.getPlace(place));