aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/c-util.boot8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot
index beaa874c..6c8cbbc8 100644
--- a/src/interp/c-util.boot
+++ b/src/interp/c-util.boot
@@ -1499,9 +1499,17 @@ declareGlobalVariables: %List -> %List
declareGlobalVariables vars ==
["DECLARE",["SPECIAL",:vars]]
+++ Return true if `form' contains an EXIT-form that matches
+++ the parent node of `form'.
+matchingEXIT form ==
+ atomic? form or form.op is 'SEQ => false
+ form.op is 'EXIT => true
+ or/[matchingEXIT x for x in form]
+
simplifySEQ form ==
atomic? form => form
form is ["SEQ",[op,a]] and op in '(EXIT RETURN) => simplifySEQ a
+ form is ['SEQ,s] and not matchingEXIT s => simplifySEQ s
for stmts in tails form repeat
stmts.first := simplifySEQ first stmts
form