From 473189342b343d3009ce81a0405b14ed0d2fab8f Mon Sep 17 00:00:00 2001 From: Jonny Date: Sun, 2 Mar 2025 03:49:21 +0000 Subject: [PATCH] refactor: remove commented out code in main.scala --- src/main/wacc/Main.scala | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/main/wacc/Main.scala b/src/main/wacc/Main.scala index a47c34c..750a548 100644 --- a/src/main/wacc/Main.scala +++ b/src/main/wacc/Main.scala @@ -81,34 +81,6 @@ def frontend( def backend(typedProg: microWacc.Program): Chain[asm.AsmLine] = asmGenerator.generateAsm(typedProg) -// TODO: filename being String seems unnatural due to Path refactor -// TODO: this function is doing too much should refactor -// def compile(filename: String, outputDir: Option[Path], log: Boolean): IO[Int] = -// val logAction: String => IO[Unit] = -// if (log) logger.info(_) -// else (_ => IO.unit) -// for { -// contents <- IO.delay( -// os.read(os.Path(filename)) -// ) // TODO: Is IO as a wrapper ok or do we require .delay - also, should it be .blocking? -// _ <- logAction(s"Compiling file: $filename") -// result <- frontend(contents) -// exitCode <- result.fold( -// code => logger.error(s"Compilation failed for $filename\nExit code: $code").as(code), -// typedProg => -// val outDir = outputDir.getOrElse(Paths.get(filename).getParent) -// IO.delay( -// Files.createDirectories(outDir) -// ) // TODO: Is IO as a wrapper ok or do we require .delay - also, should it be .blocking? -// val outputFile = outDir.resolve(filename.stripSuffix(".wacc") + ".s") -// writer.writeTo( -// backend(typedProg), -// outputFile -// ) *> // TODO: I dont think we need IO here if we look at the implementation of writer -// logAction(s"Compilation succeeded: $filename").as(0) -// ) -// } yield exitCode - def compile(filePath: Path, outputDir: Option[Path], log: Boolean): IO[Int] = { val logAction: String => IO[Unit] = if (log) logger.info(_)