mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add pass to lower useState
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user