Skip to content

Commit

Permalink
Revert "fix error location in tail call"
Browse files Browse the repository at this point in the history
  • Loading branch information
mahrud authored and d-torrance committed Oct 27, 2024
1 parent 1064658 commit 00079fc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions M2/Macaulay2/d/evaluate.d
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export nextS := setupvar("next", nullE);
export applyIteratorS := setupvar("applyIterator", nullE);
export joinIteratorsS := setupvar("joinIterators", nullE);

handleError(c:Code,e:Expr):Expr;
eval(c:Code):Expr;
applyEE(f:Expr,e:Expr):Expr;
export evalAllButTail(c:Code):Code := while true do c = (
Expand Down Expand Up @@ -631,11 +630,11 @@ export applyFCC(fc:FunctionClosure,ec:Code):Expr := (
f.frameID = desc.frameID;
f.values.0 = e;
);
ret := nullE; tailCode := dummyCode;
ret := nullE;
while true do (
localFrame = f;
recursionDepth = recursionDepth + 1;
tailCode = evalAllButTail(model.body);
tailCode := evalAllButTail(model.body);
recursionDepth = recursionDepth - 1;
-- formerly, just ret := eval(model.body); now do tail recursion instead
when tailCode
Expand Down Expand Up @@ -748,7 +747,7 @@ export applyFCC(fc:FunctionClosure,ec:Code):Expr := (
f.frameID = -2; -- just to be tidy, not really needed
recycleBin.framesize = f;
);
when ret is Error do returnFromFunction(handleError(tailCode,ret)) else ret -- this check takes time, too!
when ret is err:Error do returnFromFunction(ret) else ret -- this check takes time, too!
)
else (
f := Frame(previousFrame,desc.frameID,framesize,false,
Expand Down Expand Up @@ -1315,7 +1314,7 @@ steppingFurther(c:Code):bool := steppingFlag && (
microStepCount >= 0)
else false);

export handleError(c:Code,e:Expr):Expr := (
handleError(c:Code,e:Expr):Expr := (
when e is err:Error do (
if SuppressErrors then return e;
if err.message == returnMessage
Expand Down

0 comments on commit 00079fc

Please sign in to comment.