diff options
author | dos-reis <gdr@axiomatics.org> | 2011-08-14 03:30:48 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-08-14 03:30:48 +0000 |
commit | 775f2c3cca11ab64df713afb7f35363afe5d4ce0 (patch) | |
tree | aec69a68ef31a45f12368475b501841bada1f010 /src/interp | |
parent | 1734e62de427defcd090a95bc8b3b879c67d3fbf (diff) | |
download | open-axiom-775f2c3cca11ab64df713afb7f35363afe5d4ce0.tar.gz |
* interp/compiler.boot (compRepeatOrCollect): Set $loopKind directly.
(complainIfShadowing): Don't complain when collecting.
* algebra/contfrac.spad.pamphlet: Remove capsule-level declaration
of local variables.
* algebra/cycles.spad.pamphlet: Likewise.
* algebra/cyclotom.spad.pamphlet: Likewise.
* algebra/ddfact.spad.pamphlet: Likewise.
* algebra/fortpak.spad.pamphlet: Likewise.
* algebra/lingrob.spad.pamphlet: Likewise.
* algebra/numode.spad.pamphlet: Likewise.
* algebra/numquad.spad.pamphlet: Likewise.
* algebra/out.spad.pamphlet: Likewise.
* algebra/perman.spad.pamphlet: Likewise.
* algebra/view2D.spad.pamphlet: Likewise.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/compiler.boot | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 9498f917..c85d1e9f 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -2342,27 +2342,26 @@ compRepeatOrCollect(form,m,e) == $mayHaveFreeIteratorVariables: local := false oldEnv := e aggr := nil - [repeatOrCollect,:itl,body]:= form + [$loopKind,:itl,body]:= form itl':= [([x',e]:= compIterator(x,e) or return "failed"; x') for x in itl] itl'="failed" => nil targetMode:= first $exitModeStack bodyMode:= - repeatOrCollect="COLLECT" => + $loopKind="COLLECT" => targetMode = $EmptyMode => (aggr:=["List",$EmptyMode]; $EmptyMode) [aggr,u] := modeIsAggregateOf('List,targetMode,e) => u [aggr,u] := modeIsAggregateOf('PrimitiveArray,targetMode,e) => - repeatOrCollect := "%CollectV" + $loopKind := "%CollectV" u [aggr,u] := modeIsAggregateOf('Vector,targetMode,e) => - repeatOrCollect := "%CollectV" + $loopKind := "%CollectV" u stackMessage('"Invalid collect bodytype") return nil -- If we're doing a collect, and the type isn't conformable -- then we've boobed. JHD 26.July.1990 -- ??? we hve a plain old loop; the return type should be Void - $loopKind := repeatOrCollect $NoValueMode [body',m',e'] := compOrCroak(body,bodyMode,e) or return nil -- Massage the loop body if we have a structured jump. @@ -2372,11 +2371,11 @@ compRepeatOrCollect(form,m,e) == [untilCode,.,e']:= comp($until,$Boolean,e') itl':= substitute(["UNTIL",untilCode],'$until,itl') form':= - repeatOrCollect = "%CollectV" => + $loopKind = "%CollectV" => ["%CollectV",localReferenceIfThere m',:itl',body'] -- We are phasing out use of LISP macros COLLECT and REPEAT. - repeatOrCollect = "COLLECT" => ['%collect,:itl',body'] - [repeatOrCollect,:itl',body'] + $loopKind = "COLLECT" => ['%collect,:itl',body'] + [$loopKind,:itl',body'] m'' := aggr is [c,.] and c in '(List PrimitiveArray Vector) => [c,m'] m' @@ -2431,6 +2430,7 @@ compIntegerValue(x,e) == ++ Issue a diagnostic if `x' names a loop variable with a matching ++ declaration or definition in the enclosing scope. complainIfShadowing(x,e) == + $loopKind = 'COLLECT => nil -- collect loop variables always shadow if getmode(x,e) ~= nil then $mayHaveFreeIteratorVariables := true -- bound in compRepeatOrCollect stackWarning('"loop variable %1b shadows variable from enclosing scope",[x]) |