diff --git a/compiler/forget/packages/playground/components/Editor/Output.tsx b/compiler/forget/packages/playground/components/Editor/Output.tsx index 22cb39aa90..3214ab5edf 100644 --- a/compiler/forget/packages/playground/components/Editor/Output.tsx +++ b/compiler/forget/packages/playground/components/Editor/Output.tsx @@ -31,6 +31,7 @@ const { printReactiveFunction, propagateScopeDependencies, pruneUnusedLabels, + pruneUnusedScopes, } = HIR; const MemoizedOutput = memo(Output); @@ -97,6 +98,7 @@ function compile(source: string): CompilerOutput | CompilerError { pruneUnusedLabels(reactiveFunction); flattenReactiveLoops(reactiveFunction); propagateScopeDependencies(reactiveFunction); + pruneUnusedScopes(reactiveFunction); const reactiveFunctionOutput = printReactiveFunction(reactiveFunction); const ast = codegenReactiveFunction(reactiveFunction); diff --git a/compiler/forget/src/index.ts b/compiler/forget/src/index.ts index 11599dc923..4c027d37b6 100644 --- a/compiler/forget/src/index.ts +++ b/compiler/forget/src/index.ts @@ -28,6 +28,7 @@ import { inferReactiveScopeVariables } from "./ReactiveScopes/InferReactiveScope import { printReactiveFunction } from "./ReactiveScopes/PrintReactiveFunction"; import { propagateScopeDependencies } from "./ReactiveScopes/PropagateScopeDependencies"; import { pruneUnusedLabels } from "./ReactiveScopes/PruneUnusedLabels"; +import { pruneUnusedScopes } from "./ReactiveScopes/PruneUnusedScopes"; import { eliminateRedundantPhi } from "./SSA/EliminateRedundantPhi"; import enterSSA from "./SSA/EnterSSA"; import { leaveSSA } from "./SSA/LeaveSSA"; @@ -73,6 +74,7 @@ export const HIR = { printHIR, printReactiveFunction, pruneUnusedLabels, + pruneUnusedScopes, }; export default BabelPlugin;