From 768215c5b8d4a156c3c8f53f2f825e32270afa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BE=AA?= Date: Sat, 7 Dec 2024 00:59:09 +1300 Subject: [PATCH] up --- .../src/main/scala/chester/backend/scala/Scala.scala | 7 ++++--- compiler213/shared/src/main/scala/chester/scala/Test.scala | 4 +++- 2 files changed, 7 insertions(+), 4 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 1e410562..990e6a98 100644 --- a/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala +++ b/compiler213/shared/src/main/scala/chester/backend/scala/Scala.scala @@ -1,7 +1,8 @@ package chester.backend.scala import scala.meta -import chester.syntax.core.* +import chester.syntax.core._ +import chester.syntax.core.simple._ object Scala { case class ScalaContext() def compileExpr(term: Term)(implicit ctx: ScalaContext = null): meta.Term = term match { @@ -23,9 +24,9 @@ object Scala { case SymbolType(_) => meta.Type.Name("Symbol") case _ => throw new NotImplementedError(s"not implemented ${ty.getClass.getName} $ty") } - def compileStmt(stmt: core.StmtTerm)(implicit ctx: ScalaContext = null): meta.Stat = stmt match { + def compileStmt(stmt: StmtTerm)(implicit ctx: ScalaContext = null): meta.Stat = stmt match { case LetStmtTerm(localv, value, ty, m) => - Defn.Val( + meta.Defn.Val( mods = Nil, pats = List(meta.Pat.Var(name = meta.Term.Name(localv.name))), decltpe = Some(compileTy(ty)), diff --git a/compiler213/shared/src/main/scala/chester/scala/Test.scala b/compiler213/shared/src/main/scala/chester/scala/Test.scala index f3d50851..2c49aff3 100644 --- a/compiler213/shared/src/main/scala/chester/scala/Test.scala +++ b/compiler213/shared/src/main/scala/chester/scala/Test.scala @@ -7,10 +7,12 @@ import chester.syntax.core import scala.meta._ +import chester.syntax.core._ +import chester.syntax.core.simple._ object Test { val test: meta.Term.Apply = q"function(argument)" def callit(): Unit = { println(test) - println(Scala.compileExpr(core.BooleanTerm(false, meta = None))) + println(Scala.compileExpr(BooleanTerm(false, meta = None))) } }