[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.
Joe Savona committed
Dec 15, 2023 at 13:47 UTC
ec27708024d134ee13fbd11bfe4043b4cdda148b
1 file changed
+3
-8
compiler/packages/babel-plugin-react-forget/src/Inference/AnalyseFunctions.ts
+3
-8
@@ -10,12 +10,11 @@ import {
10
Effect,
11
HIRFunction,
12
Identifier,
13
- isRefValueType,
14
- isSetStateType,
15
- isUseRefType,
13
LoweredFunction,
14
Place,
15
ReactiveScopeDependency,
16
+ isRefValueType,
17
+ isUseRefType,
18
} from "../HIR";
19
import { deadCodeElimination } from "../Optimization";
20
import { inferReactiveScopeVariables } from "../ReactiveScopes";
@@ -139,11 +138,7 @@ function infer(
138
name = dep.identifier.name;
139
}
140
142
- if (
143
- isUseRefType(dep.identifier) ||
144
- isRefValueType(dep.identifier) ||
145
- isSetStateType(dep.identifier)
146
- ) {
141
+ if (isUseRefType(dep.identifier) || isRefValueType(dep.identifier)) {
142
/*
143
* TODO: this is a hack to ensure we treat functions which reference refs
144
* as having a capture and therefore being considered mutable. this ensures