From df58546f4e3556a5f6f30495bd57f7039cdc0f13 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Thu, 1 Dec 2022 12:56:45 -0500 Subject: [PATCH] Codegen TValue are just Expressions (#839) --- compiler/forget/src/HIR/Codegen.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/compiler/forget/src/HIR/Codegen.ts b/compiler/forget/src/HIR/Codegen.ts index 24ed547639..ca3d62f412 100644 --- a/compiler/forget/src/HIR/Codegen.ts +++ b/compiler/forget/src/HIR/Codegen.ts @@ -91,12 +91,7 @@ type Temporaries = Map; class CodegenVisitor implements - Visitor< - Array, - t.Expression | t.Statement | t.JSXFragment, - t.Statement, - t.SwitchCase - > + Visitor, t.Expression, t.Statement, t.SwitchCase> { depth: number = 0; temp: Map = new Map(); @@ -105,15 +100,10 @@ class CodegenVisitor this.depth++; return []; } - visitValue( - value: InstructionValue - ): t.Expression | t.Statement | t.JSXFragment { + visitValue(value: InstructionValue): t.Expression { return codegenInstructionValue(this.temp, value); } - visitInstruction( - instr: Instruction, - value: t.Expression | t.Statement | t.JSXFragment - ): t.Statement { + visitInstruction(instr: Instruction, value: t.Expression): t.Statement { if (t.isStatement(value)) { return value; } @@ -256,7 +246,7 @@ function codegenLabel(id: BlockId): string { function codegenInstructionValue( temp: Temporaries, instrValue: InstructionValue -): t.Expression | t.JSXFragment | t.Statement { +): t.Expression { let value: t.Expression; switch (instrValue.kind) { case "ArrayExpression": {