aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/ast/typed/TypedFunctionStatementBehaviour.java14
-rw-r--r--src/main/java/org/shedlang/compiler/ast/untyped/UntypedFunctionStatementBehaviour.java12
2 files changed, 25 insertions, 1 deletions
diff --git a/src/main/java/org/shedlang/compiler/ast/typed/TypedFunctionStatementBehaviour.java b/src/main/java/org/shedlang/compiler/ast/typed/TypedFunctionStatementBehaviour.java
index 0299fd92..d669462f 100644
--- a/src/main/java/org/shedlang/compiler/ast/typed/TypedFunctionStatementBehaviour.java
+++ b/src/main/java/org/shedlang/compiler/ast/typed/TypedFunctionStatementBehaviour.java
@@ -9,8 +9,20 @@ public sealed interface TypedFunctionStatementBehaviour {
static TypedFunctionStatementBehaviour blockReturn(Type type) {
return new BlockReturn(type);
}
-
+ /**
+ * The function statement causes the function to terminate i.e. no other
+ * statements in the function will be executed.
+ */
record Terminate() implements TypedFunctionStatementBehaviour {}
+
+ /**
+ * The function statement returns from the current block with a value of the
+ * given type.
+ */
record BlockReturn(Type type) implements TypedFunctionStatementBehaviour {}
+
+ /**
+ * The function statement passes execution to the next function statement.
+ */
record Continue() implements TypedFunctionStatementBehaviour {}
}
diff --git a/src/main/java/org/shedlang/compiler/ast/untyped/UntypedFunctionStatementBehaviour.java b/src/main/java/org/shedlang/compiler/ast/untyped/UntypedFunctionStatementBehaviour.java
index 82ee9ce5..2a8358c6 100644
--- a/src/main/java/org/shedlang/compiler/ast/untyped/UntypedFunctionStatementBehaviour.java
+++ b/src/main/java/org/shedlang/compiler/ast/untyped/UntypedFunctionStatementBehaviour.java
@@ -1,7 +1,19 @@
package org.shedlang.compiler.ast.untyped;
public enum UntypedFunctionStatementBehaviour {
+ /**
+ * The function statement causes the function to terminate i.e. no other
+ * statements in the function will be executed.
+ */
TERMINATE,
+
+ /**
+ * The function statement returns from the current block with a value.
+ */
BLOCK_RETURN,
+
+ /**
+ * The function statement passes execution to the next function statement.
+ */
CONTINUE,
}