From a65bf197d7f166c7778cffd2ef831ae182872f59 Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Tue, 14 Feb 2023 23:07:16 +0000 Subject: [PATCH] [hir] Add Memo hooks --- .../src/Inference/InferReferenceEffects.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/compiler/forget/src/Inference/InferReferenceEffects.ts b/compiler/forget/src/Inference/InferReferenceEffects.ts index f748f0c98e..5b98328e98 100644 --- a/compiler/forget/src/Inference/InferReferenceEffects.ts +++ b/compiler/forget/src/Inference/InferReferenceEffects.ts @@ -835,9 +835,25 @@ const HOOKS: Map = new Map([ valueKind: ValueKind.Frozen, }, ], + [ + "useMemo", + { + kind: "Memo", + effectKind: Effect.Freeze, + valueKind: ValueKind.Frozen, + }, + ], + [ + "useCallback", + { + kind: "Memo", + effectKind: Effect.Freeze, + valueKind: ValueKind.Frozen, + }, + ], ]); -type HookKind = "State" | "Ref" | "Custom"; +type HookKind = "State" | "Ref" | "Custom" | "Memo"; type Hook = { kind: HookKind; effectKind: Effect; valueKind: ValueKind }; export function parseHookCall(place: Place): Hook | null {