From 38fbf77919f1e2818a152f6d26cf69b17c137a37 Mon Sep 17 00:00:00 2001 From: pzinn Date: Wed, 18 Sep 2024 09:00:06 +1000 Subject: [PATCH] change locate FunctionBody --- M2/Macaulay2/d/convertr.d | 2 +- M2/Macaulay2/d/debugging.dd | 5 ++++- M2/Macaulay2/d/evaluate.d | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/M2/Macaulay2/d/convertr.d b/M2/Macaulay2/d/convertr.d index dad78ec9a9..a6af7fe667 100644 --- a/M2/Macaulay2/d/convertr.d +++ b/M2/Macaulay2/d/convertr.d @@ -438,7 +438,7 @@ export convert0(e:ParseTree):Code := ( p:=treePosition(a.lhs); fc:=functionCode( unseq(c:=convert0(a.rhs)),a.desc,hash_t(0), - combinePositionC(p,codePosition(c), a.Operator.position)); + combinePositionR(p,codePosition(c))); fc.hash = hashFromAddress(Expr(fc)); Code(fc)) is u:Unary do ( diff --git a/M2/Macaulay2/d/debugging.dd b/M2/Macaulay2/d/debugging.dd index fc93b42b64..d944196a15 100644 --- a/M2/Macaulay2/d/debugging.dd +++ b/M2/Macaulay2/d/debugging.dd @@ -204,7 +204,10 @@ locate(e:Expr):Expr := ( is Nothing do nullE is Sequence do locate(lookupfun(e)) is f:FunctionClosure do locate(f.model.position) - is f:functionCode do locate(codePosition(f.body)) + is f:functionCode do ( + p:=f.position; + locate(Position(p.filename,p.lineF,p.columnF,p.lineR,p.columnR,p.lineF,p.columnF,p.loadDepth)) + ) -- TODO: can we use binary debug symbols? is CompiledFunction do nullE is CompiledFunctionBody do nullE diff --git a/M2/Macaulay2/d/evaluate.d b/M2/Macaulay2/d/evaluate.d index 7495ef2266..561f35decf 100644 --- a/M2/Macaulay2/d/evaluate.d +++ b/M2/Macaulay2/d/evaluate.d @@ -593,7 +593,7 @@ export applyFCS(c:FunctionClosure,v:Sequence):Expr := ( ); wrongModel1(model:functionCode):Expr := printErrorMessageE( - Code(model), + Position(model.position.filename,model.position.lineL,model.position.columnL,model.position.lineL,model.position.columnL,model.position.lineL,model.position.columnL,model.position.loadDepth), "expected " + tostring(model.desc.numparms) + " argument" + (if model.desc.numparms == 1 then "" else "s") + " but got 1" );