From 7b679c464516e0c3e3bf7bfba4e8eb3249c3890b Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 25 Dec 2011 02:19:28 +0000 Subject: * interp/g-opt.boot (unnestWhen!): Recurse into more control structures. --- src/ChangeLog | 5 +++++ src/interp/g-opt.boot | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2018fd03..5a05ae7f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-12-24 Gabriel Dos Reis + + * interp/g-opt.boot (unnestWhen!): Recurse into more control + structures. + 2011-12-24 Gabriel Dos Reis * algebra/rep2.spad.pamphlet (RepresentationPackage2) diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 089e2718..2bdde63a 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -318,7 +318,13 @@ unnestWhen! x == f x where x do abstraction? x => x.absBody := f x.absBody - x is ['%leave,.,y] => second(x.args) := f y + x is ['%leave,.,y] or x is ['%return,.,y] => second(x.args) := f y + x is ['%when,:.] => + for cl in x.args repeat + second(cl) := f second cl + x is ['%seq,:.] => + for stmts in tails x.args repeat + stmts.first := f first stmts x ++ Transform nested-to-tower. -- cgit v1.2.3