Add type to DeclareLocal
Joe Savona committed
Feb 5, 2024 at 21:51 UTC
292a247cc44d6647d87ef4eaa6ef54521550a669
4 files changed
+5
compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts
+2
@@ -867,6 +867,7 @@ function lowerStatement(
867
kind,
868
place,
869
},
870
+ type: null,
871
loc: id.node.loc ?? GeneratedSource,
872
});
873
}
@@ -1200,6 +1201,7 @@ function lowerStatement(
1201
kind: InstructionKind.Catch,
1202
place: { ...place },
1203
},
1204
+ type: null,
1205
loc: handlerBindingPath.node.loc ?? GeneratedSource,
1206
});
1207
compiler/packages/babel-plugin-react-forget/src/HIR/HIR.ts
+1
@@ -664,6 +664,7 @@ export type InstructionValue =
664
| {
665
kind: "DeclareLocal";
666
lvalue: LValue;
667
+ type: t.FlowType | t.TSType | null;
668
loc: SourceLocation;
669
}
670
| {
compiler/packages/babel-plugin-react-forget/src/Inference/InlineImmediatelyInvokedFunctionExpressions.ts
+1
@@ -288,6 +288,7 @@ function declareTemporary(
288
place: result,
289
kind: InstructionKind.Let,
290
},
291
+ type: null,
292
loc: result.loc,
293
},
294
});
compiler/packages/babel-plugin-react-forget/src/Optimization/DeadCodeElimination.ts
+1
@@ -251,6 +251,7 @@ function rewriteInstruction(instr: Instruction, state: State): void {
251
instr.value = {
252
kind: "DeclareLocal",
253
lvalue: instr.value.lvalue,
254
+ type: instr.value.type,
255
loc: instr.value.loc,
256
};
257
}