aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/shedlang/compiler/stackir
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-11-02 23:07:44 +0000
committerMichael Williamson <mike@zwobble.org>2023-11-02 23:07:44 +0000
commitc9ffb931adc50091fd86ea9d09c423ab16020416 (patch)
tree88f7d0b258ff083293e0fb292765252c5676a3f8 /src/main/java/org/shedlang/compiler/stackir
parent298700108a286fa7154e4a638017c9fbebf5c3ff (diff)
Add typed unit node
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);