[typer] Remove unnecessary unifier parameter
Sathya Gunasekaran committed
Jan 5, 2023 at 13:46 UTC
159a3f64d0d52736300f40ed4018ecd3a94ca331
1 file changed
+4
-7
compiler/forget/src/TypeInference/InferTypes.ts
+4
-7
@@ -38,7 +38,7 @@ function isPrimitiveBinaryOp(op: t.BinaryExpression["operator"]) {
38
39
export default function (func: HIRFunction) {
40
const unifier = new Unifier();
41
- for (const e of generate(func, unifier)) {
41
+ for (const e of generate(func)) {
42
unifier.unify(e.left, e.right);
43
}
44
apply(func, unifier);
@@ -61,18 +61,15 @@ type TypeEquation = {
61
right: Type;
62
};
63
64
-function* generate(func: HIRFunction, unifier: Unifier) {
64
+function* generate(func: HIRFunction) {
65
for (const [_, block] of func.body.blocks) {
66
for (const instr of block.instructions) {
67
- yield* generateTypeEquation(instr, unifier);
67
+ yield* generateTypeEquation(instr);
68
}
69
}
70
}
71
72
-function generateTypeEquation(
73
- instr: Instruction,
74
- unifier: Unifier
75
-): Array<TypeEquation> {
72
+function generateTypeEquation(instr: Instruction): Array<TypeEquation> {
73
const equations: Array<TypeEquation> = [];
74
75
function add(left: Type, right: Type) {