diff --git a/interpreter/jvm/src/main/scala/chester/truffle/node/BooleanNode.java b/interpreter/jvm/src/main/scala/chester/truffle/node/BooleanNode.java new file mode 100644 index 00000000..a7899fed --- /dev/null +++ b/interpreter/jvm/src/main/scala/chester/truffle/node/BooleanNode.java @@ -0,0 +1,33 @@ +package chester.truffle.node; + +import chester.syntax.core.BooleanTermC; +import chester.syntax.core.TermMeta; +import com.oracle.truffle.api.frame.VirtualFrame; +import com.oracle.truffle.api.nodes.NodeInfo; +import scala.Option; + +@NodeInfo(shortName = "bool") +public final class BooleanNode extends LiteralNode implements BooleanTermC { + final boolean value; + final Option meta; + + public BooleanNode(boolean value, Option meta) { + this.value = value; + this.meta = meta; + } + + @Override + public Object executeGeneric(VirtualFrame frame) { + return value; + } + + @Override + public boolean value() { + return value; + } + + @Override + public Option meta() { + return meta; + } +} diff --git a/interpreter/jvm/src/main/scala/chester/truffle/node/BooleanNode.scala b/interpreter/jvm/src/main/scala/chester/truffle/node/BooleanNode.scala deleted file mode 100644 index f5532297..00000000 --- a/interpreter/jvm/src/main/scala/chester/truffle/node/BooleanNode.scala +++ /dev/null @@ -1,11 +0,0 @@ -package chester.truffle.node - -import chester.syntax.core.BooleanTermC -import chester.syntax.core.TermMeta -import com.oracle.truffle.api.frame.VirtualFrame - -import scala.Option - -final case class BooleanNode(override val value: Boolean, override val meta: Option[TermMeta]) extends LiteralNode with BooleanTermC[TermNode] { - override def executeGeneric(frame: VirtualFrame): Boolean = value -}