From 686fe85364d87aa995bf080ea934674a2ece35d9 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 18 Nov 2023 14:48:54 +0000 Subject: Generate stack IR for effect field access --- src/main/java/org/shedlang/compiler/stackir/StackCompiler.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java b/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java index 4ca4de8e..8110e6da 100644 --- a/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java +++ b/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java @@ -190,6 +190,14 @@ public class StackCompiler { case StructType structType -> new FieldLoadInstruction.Receiver.Struct(structType); + case TypeLevelValueType typeLevelValueType -> { + if (typeLevelValueType.value() instanceof UserDefinedEffect effect) { + yield new FieldLoadInstruction.Receiver.Effect(effect); + } else { + throw new RuntimeException("not a type with fields"); + } + } + default -> throw new RuntimeException("not a type with fields"); }; -- cgit v1.2.3