diff --git a/compiler/forget/src/HIR/BuildHIR.ts b/compiler/forget/src/HIR/BuildHIR.ts index a2bd83581f..c994aae9e5 100644 --- a/compiler/forget/src/HIR/BuildHIR.ts +++ b/compiler/forget/src/HIR/BuildHIR.ts @@ -21,8 +21,8 @@ import { Place, ReturnTerminal, SourceLocation, - Terminal, ThrowTerminal, + Type, } from "./HIR"; import HIRBuilder, { Environment } from "./HIRBuilder"; import todo, { todoInvariant } from "./todo"; @@ -83,6 +83,7 @@ export function lower( memberPath: null, effect: Effect.Unknown, loc: param.loc ?? GeneratedSource, + type: Type.Any, }; params.push(place); }); @@ -890,6 +891,7 @@ function lowerExpression( memberPath: null, effect: Effect.Unknown, loc: left.loc, + type: Type.Any, }; builder.push({ id: makeInstructionId(0), @@ -908,6 +910,7 @@ function lowerExpression( memberPath: null, effect: Effect.Unknown, loc: left.loc, + type: Type.Any, }; builder.push({ id: makeInstructionId(0), @@ -1006,6 +1009,7 @@ function lowerExpression( memberPath: [...(object.memberPath ?? []), property.node.name], effect: Effect.Unknown, loc: exprLoc, + type: Type.Any, }; return place; } @@ -1082,6 +1086,7 @@ function lowerConditional( memberPath: null, effect: Effect.Read, loc, + type: Type.Any, }; // Block for code following the if const continuationBlock = builder.reserve(); @@ -1153,6 +1158,7 @@ function lowerJsxElementName( memberPath: null, effect: Effect.Unknown, loc: exprLoc, + type: Type.Any, }; return place; } else { @@ -1162,6 +1168,7 @@ function lowerJsxElementName( memberPath: null, effect: Effect.Unknown, loc: exprLoc, + type: Type.Any, }; builder.push({ id: makeInstructionId(0), @@ -1202,6 +1209,7 @@ function lowerJsxElement( memberPath: null, effect: Effect.Unknown, loc: exprLoc, + type: Type.Any, }; builder.push({ id: makeInstructionId(0), @@ -1225,6 +1233,7 @@ function lowerJsxElement( memberPath: null, effect: Effect.Unknown, loc: exprLoc, + type: Type.Any, }; builder.push({ id: makeInstructionId(0), @@ -1255,6 +1264,7 @@ function lowerExpressionToPlace( memberPath: null, effect: Effect.Unknown, loc: exprLoc, + type: Type.Any, }; builder.push({ id: makeInstructionId(0), @@ -1303,6 +1313,7 @@ function lowerLVal(builder: HIRBuilder, exprPath: NodePath): Place { memberPath: null, effect: Effect.Unknown, loc: exprLoc, + type: Type.Any, }; return place; } @@ -1322,6 +1333,7 @@ function lowerLVal(builder: HIRBuilder, exprPath: NodePath): Place { memberPath: [...(object.memberPath ?? []), propertyPath.node.name], effect: Effect.Unknown, loc: exprLoc, + type: Type.Any, }; return place; } diff --git a/compiler/forget/src/HIR/HIR.ts b/compiler/forget/src/HIR/HIR.ts index 3b10a356c6..4cb4bc2384 100644 --- a/compiler/forget/src/HIR/HIR.ts +++ b/compiler/forget/src/HIR/HIR.ts @@ -270,6 +270,7 @@ export type Place = { memberPath: Array | null; effect: Effect; loc: SourceLocation; + type: Type; }; /** @@ -398,3 +399,7 @@ export function makeInstructionId(id: number): InstructionId { ); return id as InstructionId; } + +export enum Type { + Any, +} diff --git a/compiler/forget/src/HIR/InferReferenceEffects.ts b/compiler/forget/src/HIR/InferReferenceEffects.ts index 353c01e561..c0c1dd88df 100644 --- a/compiler/forget/src/HIR/InferReferenceEffects.ts +++ b/compiler/forget/src/HIR/InferReferenceEffects.ts @@ -16,6 +16,7 @@ import { InstructionValue, Phi, Place, + Type, ValueKind, } from "./HIR"; import { printMixedHIR, printPlace, printSourceLocation } from "./PrintHIR"; @@ -77,6 +78,7 @@ export default function inferReferenceEffects(fn: HIRFunction) { identifier: fn.id as any, loc: fn.loc, effect: Effect.Freeze, + type: Type.Any, }; const value: InstructionValue = { kind: "Primitive", diff --git a/compiler/forget/src/HIR/LeaveSSA.ts b/compiler/forget/src/HIR/LeaveSSA.ts index 81a1d17334..0f8fb49870 100644 --- a/compiler/forget/src/HIR/LeaveSSA.ts +++ b/compiler/forget/src/HIR/LeaveSSA.ts @@ -16,6 +16,7 @@ import { makeInstructionId, Phi, Place, + Type, } from "./HIR"; import { eachInstructionValueOperand, eachTerminalOperand } from "./visitors"; @@ -153,6 +154,7 @@ export function leaveSSA(fn: HIRFunction) { identifier, effect: Effect.Mutate, loc: GeneratedSource, + type: Type.Any, }, kind: InstructionKind.Let, },