Add pass to lower useState

This commit is contained in:
Sathya Gunasekaran
2023-09-05 11:13:30 +01:00
parent 403881c548
commit 4571979e46
2 changed files with 16 additions and 0 deletions
@@ -7,6 +7,7 @@
import { NodePath } from "@babel/traverse";
import * as t from "@babel/types";
import { lowerUseState } from "../Forest";
import {
HIRFunction,
ReactiveFunction,
@@ -245,6 +246,15 @@ export function* run(
value: reactiveFunction,
});
if (config?.enableForest) {
lowerUseState(reactiveFunction);
yield log({
kind: "reactive",
name: "LowerUseState",
value: reactiveFunction,
});
}
promoteUsedTemporaries(reactiveFunction);
yield log({
kind: "reactive",
@@ -28,3 +28,9 @@ export { pruneTemporaryLValues as pruneUnusedLValues } from "./PruneTemporaryLVa
export { pruneUnusedLabels } from "./PruneUnusedLabels";
export { pruneUnusedScopes } from "./PruneUnusedScopes";
export { renameVariables } from "./RenameVariables";
export {
ReactiveFunctionTransform,
Transformed,
eachReactiveValueOperand,
visitReactiveFunction,
} from "./visitors";