From 9f7878c7c01eb0c7d6d95ed156850b02bbb02f32 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Mon, 28 Nov 2022 17:48:59 -0500 Subject: [PATCH] [easy] remove `isFallthrough` arg from `mapTerminalSuccessors` The argument was unused and a confusing boolean argument that's easy to mix up. Suggesting to remove it until we see a need for it at which point we might want to introduce an enum to make the argument more obvious. --- compiler/forget/src/HIR/visitors.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/forget/src/HIR/visitors.ts b/compiler/forget/src/HIR/visitors.ts index 2377c1e350..ed2a73c97e 100644 --- a/compiler/forget/src/HIR/visitors.ts +++ b/compiler/forget/src/HIR/visitors.ts @@ -146,11 +146,11 @@ export function mapInstructionOperands( */ export function mapTerminalSuccessors( terminal: Terminal, - fn: (block: BlockId, isFallthrough: boolean) => BlockId + fn: (block: BlockId) => BlockId ): Terminal { switch (terminal.kind) { case "goto": { - const target = fn(terminal.block, false); + const target = fn(terminal.block); return { kind: "goto", block: target, @@ -159,10 +159,10 @@ export function mapTerminalSuccessors( }; } case "if": { - const consequent = fn(terminal.consequent, false); - const alternate = fn(terminal.alternate, false); + const consequent = fn(terminal.consequent); + const alternate = fn(terminal.alternate); const fallthrough = - terminal.fallthrough !== null ? fn(terminal.fallthrough, true) : null; + terminal.fallthrough !== null ? fn(terminal.fallthrough) : null; return { kind: "if", test: terminal.test, @@ -174,14 +174,14 @@ export function mapTerminalSuccessors( } case "switch": { const cases = terminal.cases.map((case_) => { - const target = fn(case_.block, false); + const target = fn(case_.block); return { test: case_.test, block: target, }; }); const fallthrough = - terminal.fallthrough !== null ? fn(terminal.fallthrough, true) : null; + terminal.fallthrough !== null ? fn(terminal.fallthrough) : null; return { kind: "switch", test: terminal.test, @@ -202,9 +202,9 @@ export function mapTerminalSuccessors( return terminal; } case "while": { - const test = fn(terminal.test, false); - const loop = fn(terminal.loop, true); - const fallthrough = fn(terminal.fallthrough, true); + const test = fn(terminal.test); + const loop = fn(terminal.loop); + const fallthrough = fn(terminal.fallthrough); return { kind: "while", loc: terminal.loc,