aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/shedlang/compiler/stackir
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/shedlang/compiler/stackir')
-rw-r--r--src/main/java/org/shedlang/compiler/stackir/StackCompiler.java10
1 files changed, 10 insertions, 0 deletions
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);