[typer] Add inferTypes pass to playground

This commit is contained in:
Sathya Gunasekaran
2022-12-20 14:55:56 +00:00
parent c130bcc9c2
commit 69fbdfc7cd
3 changed files with 14 additions and 0 deletions
@@ -20,6 +20,7 @@ const {
enterSSA,
Environment,
flattenReactiveLoops,
inferTypes,
inferMutableRanges,
inferReactiveScopes,
inferReactiveScopeVariables,
@@ -47,6 +48,7 @@ type CompilerOutput = {
ssaOutput: string;
hirOutput: string;
eliminateRedundantPhiOutput: string;
inferTypesOutput: string;
inferReferenceEffectsOutput: string;
inferMutableRangesOutput: string;
inferReactiveScopeVariablesOutput: string;
@@ -79,6 +81,9 @@ function compile(source: string): CompilerOutput | CompilerError {
eliminateRedundantPhi(ir);
const eliminateRedundantPhiOutput = printHIR(ir.body);
inferTypes(ir);
const inferTypesOutput = printHIR(ir.body);
inferReferenceEffects(ir);
const inferReferenceEffectsOutput = printHIR(ir.body);
@@ -124,6 +129,7 @@ function compile(source: string): CompilerOutput | CompilerError {
hirOutput,
ssaOutput,
eliminateRedundantPhiOutput,
inferTypesOutput,
inferReferenceEffectsOutput,
inferMutableRangesOutput,
inferReactiveScopeVariablesOutput,
@@ -165,6 +171,11 @@ function Output({ store, setTabsOpen, tabsOpen }: Props) {
output={compilerOutput.eliminateRedundantPhiOutput}
></TextTabContent>
),
InferTypes: (
<TextTabContent
output={compilerOutput.inferTypesOutput}
></TextTabContent>
),
InferReferenceEffects: (
<TextTabContent
output={compilerOutput.inferReferenceEffectsOutput}
@@ -11,6 +11,7 @@ export type TabTypes =
| "HIR"
| "SSA"
| "EliminateRedundantPhi"
| "InferTypes"
| "InferReferenceEffects"
| "InferMutableRanges"
| "InferReactiveScopeVariables"
+2
View File
@@ -19,6 +19,7 @@ import codegen from "./HIR/Codegen";
import { Environment } from "./HIR/HIRBuilder";
import { inferMutableRanges } from "./HIR/InferMutableRanges";
import inferReferenceEffects from "./HIR/InferReferenceEffects";
import { inferTypes } from "./HIR/InferTypes";
import printHIR, { printFunction } from "./HIR/PrintHIR";
import { buildReactiveFunction } from "./ReactiveScopes/BuildReactiveFunction";
import { codegenReactiveFunction } from "./ReactiveScopes/CodegenReactiveFunction";
@@ -63,6 +64,7 @@ export const HIR = {
eliminateRedundantPhi,
enterSSA,
Environment,
inferTypes,
inferMutableRanges,
inferReactiveScopes,
inferReactiveScopeVariables,