Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
mio-19 committed Dec 6, 2024
1 parent 45abc45 commit 768215c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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)),
Expand Down
4 changes: 3 additions & 1 deletion compiler213/shared/src/main/scala/chester/scala/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
}

0 comments on commit 768215c

Please sign in to comment.