Add new pass to playground
Joe Savona committed
Dec 20, 2022 at 12:16 UTC
828fd81be352261df570285365e21825d5f67ed2
2 files changed
+4
compiler/forget/packages/playground/components/Editor/Output.tsx
+2
@@ -31,6 +31,7 @@ const {
31
printReactiveFunction,
32
propagateScopeDependencies,
33
pruneUnusedLabels,
34
+ pruneUnusedScopes,
35
} = HIR;
36
const MemoizedOutput = memo(Output);
37
@@ -97,6 +98,7 @@ function compile(source: string): CompilerOutput | CompilerError {
98
pruneUnusedLabels(reactiveFunction);
99
flattenReactiveLoops(reactiveFunction);
100
propagateScopeDependencies(reactiveFunction);
101
+ pruneUnusedScopes(reactiveFunction);
102
const reactiveFunctionOutput = printReactiveFunction(reactiveFunction);
103
104
const ast = codegenReactiveFunction(reactiveFunction);
compiler/forget/src/index.ts
+2
@@ -28,6 +28,7 @@ import { inferReactiveScopeVariables } from "./ReactiveScopes/InferReactiveScope
28
import { printReactiveFunction } from "./ReactiveScopes/PrintReactiveFunction";
29
import { propagateScopeDependencies } from "./ReactiveScopes/PropagateScopeDependencies";
30
import { pruneUnusedLabels } from "./ReactiveScopes/PruneUnusedLabels";
31
+import { pruneUnusedScopes } from "./ReactiveScopes/PruneUnusedScopes";
32
import { eliminateRedundantPhi } from "./SSA/EliminateRedundantPhi";
33
import enterSSA from "./SSA/EnterSSA";
34
import { leaveSSA } from "./SSA/LeaveSSA";
@@ -73,6 +74,7 @@ export const HIR = {
74
printHIR,
75
printReactiveFunction,
76
pruneUnusedLabels,
77
+ pruneUnusedScopes,
78
};
79
80
export default BabelPlugin;