refactor: remove commented out code in main.scala
This commit is contained in:
@@ -81,34 +81,6 @@ def frontend(
|
|||||||
def backend(typedProg: microWacc.Program): Chain[asm.AsmLine] =
|
def backend(typedProg: microWacc.Program): Chain[asm.AsmLine] =
|
||||||
asmGenerator.generateAsm(typedProg)
|
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] = {
|
def compile(filePath: Path, outputDir: Option[Path], log: Boolean): IO[Int] = {
|
||||||
val logAction: String => IO[Unit] =
|
val logAction: String => IO[Unit] =
|
||||||
if (log) logger.info(_)
|
if (log) logger.info(_)
|
||||||
|
|||||||
Reference in New Issue
Block a user