From 159a3f64d0d52736300f40ed4018ecd3a94ca331 Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Thu, 5 Jan 2023 13:46:55 +0000 Subject: [PATCH] [typer] Remove unnecessary unifier parameter --- compiler/forget/src/TypeInference/InferTypes.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/compiler/forget/src/TypeInference/InferTypes.ts b/compiler/forget/src/TypeInference/InferTypes.ts index 49a6f18a47..f73d788e96 100644 --- a/compiler/forget/src/TypeInference/InferTypes.ts +++ b/compiler/forget/src/TypeInference/InferTypes.ts @@ -38,7 +38,7 @@ function isPrimitiveBinaryOp(op: t.BinaryExpression["operator"]) { export default function (func: HIRFunction) { const unifier = new Unifier(); - for (const e of generate(func, unifier)) { + for (const e of generate(func)) { unifier.unify(e.left, e.right); } apply(func, unifier); @@ -61,18 +61,15 @@ type TypeEquation = { right: Type; }; -function* generate(func: HIRFunction, unifier: Unifier) { +function* generate(func: HIRFunction) { for (const [_, block] of func.body.blocks) { for (const instr of block.instructions) { - yield* generateTypeEquation(instr, unifier); + yield* generateTypeEquation(instr); } } } -function generateTypeEquation( - instr: Instruction, - unifier: Unifier -): Array { +function generateTypeEquation(instr: Instruction): Array { const equations: Array = []; function add(left: Type, right: Type) {