From c9ffb931adc50091fd86ea9d09c423ab16020416 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 2 Nov 2023 23:07:44 +0000 Subject: Add typed unit node --- src/main/java/org/shedlang/compiler/stackir/StackCompiler.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/java/org/shedlang/compiler/stackir') diff --git a/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java b/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java index 8d1468c8..ecb32acd 100644 --- a/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java +++ b/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java @@ -146,6 +146,9 @@ public class StackCompiler { case TypedTupleNode typedTupleNode -> compileTuple(typedTupleNode, context); + case TypedUnitLiteralNode typedUnitLiteralNode -> + compileUnitLiteral(typedUnitLiteralNode, context); + case TypedWhenNode typedWhenNode -> compileWhen(typedWhenNode, context); }; @@ -586,6 +589,13 @@ public class StackCompiler { return context.addInstruction(instruction); } + private static Context compileUnitLiteral( + TypedUnitLiteralNode node, + Context context + ) { + return context.addInstruction(new PushUnitInstruction(node.source())); + } + private static Context compileWhen(TypedWhenNode node, Context context) { context = compileExpression(node.expression(), context); -- cgit v1.2.3