diff options
author | dos-reis <gdr@axiomatics.org> | 2010-06-12 07:17:41 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-06-12 07:17:41 +0000 |
commit | 30e7e66530a05b57abbb3bc29383c45adc5d4ec4 (patch) | |
tree | a80909929cfc4d3c389765338fb5301eed5f628b /src/interp | |
parent | 7fe9066e79d46cd3a7673301bb41fceda683f503 (diff) | |
download | open-axiom-30e7e66530a05b57abbb3bc29383c45adc5d4ec4.tar.gz |
* interp/compiler.boot (compIterate): Rewrite.
(compRepeatOrCollect): Tidy. Bind $loopBodyTag.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/compiler.boot | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 4489cf96..87d07c89 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1101,11 +1101,14 @@ compBreak(x,m,e) == compIterate: (%Symbol,%Mode,%Env) -> %Maybe %Triple compIterate(x,m,e) == x ~= "iterate" or not jumpFromLoop("REPEAT",x) => nil + index := #$exitModeStack - 1 - ($leaveLevelStack.0 + 1) $iterateCount := $iterateCount + 1 - -- We don't really produce a value; but we cannot adequately convey - -- that to the current 'EXIT' structure. So, pretend we have an - -- undefined value, which is a good enough approximation. - [["THROW","$loopBodyTag",nil],m,e] + u := coerce(['%nil,'$Void,e],$exitModeStack.index) or return nil + u := coerce(u,m) or return nil + modifyModeStack(u.mode,index) + if $loopBodyTag = nil then -- bound in compRepeatOrCollect + $loopBodyTag := MKQ gensym() + [['THROW,$loopBodyTag,u.expr],u.mode,e] --% return @@ -2267,6 +2270,7 @@ compRepeatOrCollect(form,m,e) == $until: local := nil $loopKind: local := nil $iterateCount: local := 0 + $loopBodyTag: local := nil $breakCount: local := 0 oldEnv := e aggr := nil @@ -2295,8 +2299,7 @@ compRepeatOrCollect(form,m,e) == [body',m',e'] := compOrCroak(body,bodyMode,e) or return nil -- Massage the loop body if we have a structured jump. if $iterateCount > 0 then - bodyTag := quoteForm gensym() - body' := ["CATCH",bodyTag,NSUBST(bodyTag,"$loopBodyTag",body')] + body' := ["CATCH",$loopBodyTag,body'] if $until then [untilCode,.,e']:= comp($until,$Boolean,e') itl':= substitute(["UNTIL",untilCode],'$until,itl') |