aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-06-01 17:54:16 +0000
committerdos-reis <gdr@axiomatics.org>2009-06-01 17:54:16 +0000
commit569c20a430023be60c2b38f47bccc5810c6980aa (patch)
treee7929027ccfb4584225245b0839175b34f02328d /src/interp
parentb56083910b371806c329bf4657c51db77f7040ef (diff)
downloadopen-axiom-569c20a430023be60c2b38f47bccc5810c6980aa.tar.gz
Simplify compiler ast for `return' expressions.
* interp/parse.boot (parseReturn): Remove. * interp/compiler.boot (compReturn): Tidy.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/compiler.boot3
-rw-r--r--src/interp/parse.boot10
2 files changed, 1 insertions, 12 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index d1c626e0..f14ba01d 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -1088,11 +1088,10 @@ compLeave(["leave",level,x],m,e) ==
--% return
compReturn: (%Form,%Mode,%Env) -> %Maybe %Triple
-compReturn(["return",level,x],m,e) ==
+compReturn(["return",x],m,e) ==
null $exitModeStack =>
stackAndThrow('"the return before %1b is unneccessary",[x])
nil
- level^=1 => userError '"multi-level returns not supported"
index:= MAX(0,#$exitModeStack-1)
if index >= 0 then
$returnMode:= resolve($exitModeStack.index,$returnMode)
diff --git a/src/interp/parse.boot b/src/interp/parse.boot
index e87d8906..278de20e 100644
--- a/src/interp/parse.boot
+++ b/src/interp/parse.boot
@@ -315,15 +315,6 @@ parseLeave t ==
["leave",1,a]
-parseReturn: %ParseForm -> %Form
-parseReturn t ==
- t isnt ["return",a,:b] => systemErrorHere ["parseReturn",t]
- a:= parseTran a
- b:= parseTran b
- b =>
- (if a^=1 then MOAN '"multiple-level 'return' not allowed"; ["return",1,:b])
- ["return",1,a]
-
parseJoin: %ParseForm -> %Form
parseJoin t ==
t isnt ["Join",:l] => systemErrorHere ["parseJoin",t]
@@ -496,7 +487,6 @@ for x in [["<=", :"parseLessEqual"],_
["or", :"parseOr"],_
["pretend", :"parsePretend"],_
["@@",:"parseAtAt"],_
- ["return", :"parseReturn"],_
["SEGMENT", :"parseSegment"],_
["SEQ", :"parseSeq"],_
["VCONS", :"parseVCONS"],_