From 569c20a430023be60c2b38f47bccc5810c6980aa Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 1 Jun 2009 17:54:16 +0000 Subject: Simplify compiler ast for `return' expressions. * interp/parse.boot (parseReturn): Remove. * interp/compiler.boot (compReturn): Tidy. --- src/interp/compiler.boot | 3 +-- src/interp/parse.boot | 10 ---------- 2 files changed, 1 insertion(+), 12 deletions(-) (limited to 'src/interp') 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"],_ -- cgit v1.2.3