diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-11-07 17:21:06 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-11-07 17:21:06 +0000 |
| commit | 48560d9b326a9edb73231e816791edc1b196b1b1 (patch) | |
| tree | 99ab22ae0f6abd04fbc98a08a64e7e9f859facca /src/main/java | |
| parent | e76d6c2cb90f7dc0d97e5a9b3c393f354b9348b8 (diff) | |
Generate stack IR for resume statements
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/org/shedlang/compiler/stackir/StackCompiler.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java b/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java index 0d467c0d..bad4f72c 100644 --- a/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java +++ b/src/main/java/org/shedlang/compiler/stackir/StackCompiler.java @@ -315,7 +315,7 @@ public class StackCompiler { compileFunctionReturn(functionReturn, context); case TypedResumeNode resume -> - throw new UnsupportedOperationException("TODO"); + compileResume(resume, context); case TypedWhileNode while_ -> compileWhile(while_, context); @@ -479,6 +479,12 @@ public class StackCompiler { } } + private static Context compileResume(TypedResumeNode node, Context context) { + context = compileExpression(node.expression(), context); + context = context.addInstruction(new ReturnInstruction(node.source())); + return context; + } + private static Context compileStringLiteral( TypedStringLiteralNode node, Context context |
