aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/interp/compiler.boot3
-rw-r--r--src/interp/parse.boot10
3 files changed, 7 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 250b33c8..6a30d970 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
2009-06-01 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ Simplify compiler ast for `return' expressions.
+ * interp/parse.boot (parseReturn): Remove.
+ * interp/compiler.boot (compReturn): Tidy.
+
+2009-06-01 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
Fix SF/2799238
* algebra/syntax.spad.pamphlet (SpadAst): Fix typo.
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"],_