From c5ec665a7d3e856a46e4972601c0504fb0079388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BE=AA?= Date: Fri, 25 Oct 2024 14:54:38 +1300 Subject: [PATCH] save --- .../shared/src/main/scala/chester/backend/scala/Scala.scala | 6 ++++-- compiler213/shared/src/main/scala/chester/scala/Test.scala | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala b/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala index f75fb803..2bd5904f 100644 --- a/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala +++ b/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala @@ -6,7 +6,7 @@ import scala.meta._ import chester.syntax.core._ object Scala { case class ScalaContext() - def compile(term: core.Term)(implicit ctx: ScalaContext = null): meta.Tree = term match { + def compileExpr(term: core.Term)(implicit ctx: ScalaContext = null): meta.Tree = term match { case IntegerTerm(i, _) => { require(i.isValidInt) Lit.Int(i.toInt) @@ -18,5 +18,7 @@ object Scala { case UnitTerm(_) => Lit.Unit() case _ => throw new NotImplementedError(s"not implemented ${term.getClass.getName} $term") } - + def compileStmt(stmt: core.StmtTerm)(implicit ctx: ScalaContext = null): meta.Stat = stmt match { + case _ => throw new NotImplementedError(s"not implemented ${stmt.getClass.getName} $stmt") + } } diff --git a/compiler213/shared/src/main/scala/chester/scala/Test.scala b/compiler213/shared/src/main/scala/chester/scala/Test.scala index 4c6703d1..45f3ef8e 100644 --- a/compiler213/shared/src/main/scala/chester/scala/Test.scala +++ b/compiler213/shared/src/main/scala/chester/scala/Test.scala @@ -14,6 +14,6 @@ object Test { val test: meta.Term.Apply = q"function(argument)" def callit(): Unit = { println(test) - println(Scala.compile(core.BooleanTerm(false, meta = None))) + println(Scala.compileExpr(core.BooleanTerm(false, meta = None))) } }