aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-02-07 00:39:58 +0000
committerdos-reis <gdr@axiomatics.org>2011-02-07 00:39:58 +0000
commit351022a3ec02f6e131d54f3a5bcb27a8dfffbcb0 (patch)
tree0b137b74a6663d6875e7f6d8862833f782032bd4 /src/interp
parent2eef476c721ed93b1acaaf1a77e20b5b7c73ed4f (diff)
downloadopen-axiom-351022a3ec02f6e131d54f3a5bcb27a8dfffbcb0.tar.gz
* interp/c-util.boot (matchingEXIT): New.
(simplifySEQ): Use it.
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