[typer] Add inferTypes pass to playground
Sathya Gunasekaran committed
Dec 20, 2022 at 14:55 UTC
69fbdfc7cd81e50815fafaaf927c9cb3250a1d20
3 files changed
+14
compiler/forget/packages/playground/components/Editor/Output.tsx
+11
@@ -20,6 +20,7 @@ const {
20
enterSSA,
21
Environment,
22
flattenReactiveLoops,
23
+ inferTypes,
24
inferMutableRanges,
25
inferReactiveScopes,
26
inferReactiveScopeVariables,
@@ -47,6 +48,7 @@ type CompilerOutput = {
48
ssaOutput: string;
49
hirOutput: string;
50
eliminateRedundantPhiOutput: string;
51
+ inferTypesOutput: string;
52
inferReferenceEffectsOutput: string;
53
inferMutableRangesOutput: string;
54
inferReactiveScopeVariablesOutput: string;
@@ -79,6 +81,9 @@ function compile(source: string): CompilerOutput | CompilerError {
81
eliminateRedundantPhi(ir);
82
const eliminateRedundantPhiOutput = printHIR(ir.body);
83
84
+ inferTypes(ir);
85
+ const inferTypesOutput = printHIR(ir.body);
86
+
87
inferReferenceEffects(ir);
88
const inferReferenceEffectsOutput = printHIR(ir.body);
89
@@ -124,6 +129,7 @@ function compile(source: string): CompilerOutput | CompilerError {
129
hirOutput,
130
ssaOutput,
131
eliminateRedundantPhiOutput,
132
+ inferTypesOutput,
133
inferReferenceEffectsOutput,
134
inferMutableRangesOutput,
135
inferReactiveScopeVariablesOutput,
@@ -165,6 +171,11 @@ function Output({ store, setTabsOpen, tabsOpen }: Props) {
171
output={compilerOutput.eliminateRedundantPhiOutput}
172
></TextTabContent>
173
),
174
+ InferTypes: (
175
+ <TextTabContent
176
+ output={compilerOutput.inferTypesOutput}
177
+ ></TextTabContent>
178
+ ),
179
InferReferenceEffects: (
180
<TextTabContent
181
output={compilerOutput.inferReferenceEffectsOutput}
compiler/forget/packages/playground/components/TabbedWindow.tsx
+1
@@ -11,6 +11,7 @@ export type TabTypes =
11
| "HIR"
12
| "SSA"
13
| "EliminateRedundantPhi"
14
+ | "InferTypes"
15
| "InferReferenceEffects"
16
| "InferMutableRanges"
17
| "InferReactiveScopeVariables"
compiler/forget/src/index.ts
+2
@@ -19,6 +19,7 @@ import codegen from "./HIR/Codegen";
19
import { Environment } from "./HIR/HIRBuilder";
20
import { inferMutableRanges } from "./HIR/InferMutableRanges";
21
import inferReferenceEffects from "./HIR/InferReferenceEffects";
22
+import { inferTypes } from "./HIR/InferTypes";
23
import printHIR, { printFunction } from "./HIR/PrintHIR";
24
import { buildReactiveFunction } from "./ReactiveScopes/BuildReactiveFunction";
25
import { codegenReactiveFunction } from "./ReactiveScopes/CodegenReactiveFunction";
@@ -63,6 +64,7 @@ export const HIR = {
64
eliminateRedundantPhi,
65
enterSSA,
66
Environment,
67
+ inferTypes,
68
inferMutableRanges,
69
inferReactiveScopes,
70
inferReactiveScopeVariables,