@samitouri / QOS-React-1 / commits / 74c6c992ba

[be] s/DropUseMemo/DropManualMemoization/

Renames this pass to clarify that it's dropping all manual memoization (within components), including both useMemo and useCallback.

Joe Savona committed Oct 9, 2023 at 15:25 UTC 74c6c992baf2e9eb5d138c66314a84ac9aa01f9b
3 files changed +5 -5
compiler/packages/babel-plugin-react-forget/src/Entrypoint/Pipeline.ts
+3 -3
@@ -22,7 +22,7 @@ import { Environment, PartialEnvironmentConfig } from "../HIR/Environment";
22 import { findContextIdentifiers } from "../HIR/FindContextIdentifiers";
23 import {
24 analyseFunctions,
25 - dropMemoCalls,
25 + dropManualMemoization,
26 inferMutableRanges,
27 inferReferenceEffects,
28 inlineUseMemo,
@@ -146,8 +146,8 @@ function* runWithEnvironment(
146 });
147 }
148
149 - dropMemoCalls(hir);
150 - yield log({ kind: "hir", name: "DropMemoCalls", value: hir });
149 + dropManualMemoization(hir);
150 + yield log({ kind: "hir", name: "DropManualMemoization", value: hir });
151
152 analyseFunctions(hir);
153 yield log({ kind: "hir", name: "AnalyseFunctions", value: hir });
compiler/packages/babel-plugin-react-forget/src/Inference/DropManualMemoization.ts renamed
+1 -1
@@ -7,7 +7,7 @@
7
8 import { Effect, HIRFunction, getHookKind } from "../HIR";
9
10 -export default function (func: HIRFunction): void {
10 +export function dropManualMemoization(func: HIRFunction): void {
11 for (const [_, block] of func.body.blocks) {
12 for (const instr of block.instructions) {
13 switch (instr.value.kind) {
compiler/packages/babel-plugin-react-forget/src/Inference/index.ts
+1 -1
@@ -6,7 +6,7 @@
6 */
7
8 export { default as analyseFunctions } from "./AnalyseFunctions";
9 -export { default as dropMemoCalls } from "./DropMemoCalls";
9 +export { dropManualMemoization } from "./DropManualMemoization";
10 export { inferMutableRanges } from "./InferMutableRanges";
11 export { default as inferReferenceEffects } from "./InferReferenceEffects";
12 export { inlineUseMemo } from "./InlineUseMemo";