From ec27708024d134ee13fbd11bfe4043b4cdda148b Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Fri, 15 Dec 2023 13:47:21 -0800 Subject: [PATCH] [be] Remove unnecessary check for SetState type in analyzefunctions This was used as part of the previous ValidateNoSetStateInRender, but i rewrote that to not rely on the mutable range of function expressions. --- .../src/Inference/AnalyseFunctions.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/compiler/packages/babel-plugin-react-forget/src/Inference/AnalyseFunctions.ts b/compiler/packages/babel-plugin-react-forget/src/Inference/AnalyseFunctions.ts index d701c3acc2..e69486b5e4 100644 --- a/compiler/packages/babel-plugin-react-forget/src/Inference/AnalyseFunctions.ts +++ b/compiler/packages/babel-plugin-react-forget/src/Inference/AnalyseFunctions.ts @@ -10,12 +10,11 @@ import { Effect, HIRFunction, Identifier, - isRefValueType, - isSetStateType, - isUseRefType, LoweredFunction, Place, ReactiveScopeDependency, + isRefValueType, + isUseRefType, } from "../HIR"; import { deadCodeElimination } from "../Optimization"; import { inferReactiveScopeVariables } from "../ReactiveScopes"; @@ -139,11 +138,7 @@ function infer( name = dep.identifier.name; } - if ( - isUseRefType(dep.identifier) || - isRefValueType(dep.identifier) || - isSetStateType(dep.identifier) - ) { + if (isUseRefType(dep.identifier) || isRefValueType(dep.identifier)) { /* * TODO: this is a hack to ensure we treat functions which reference refs * as having a capture and therefore being considered mutable. this ensures