From 351022a3ec02f6e131d54f3a5bcb27a8dfffbcb0 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 7 Feb 2011 00:39:58 +0000 Subject: * interp/c-util.boot (matchingEXIT): New. (simplifySEQ): Use it. --- src/interp/c-util.boot | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/interp') 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 -- cgit v1.2.3