From d1013525e55860d5789752e2de76814721670076 Mon Sep 17 00:00:00 2001 From: pzinn Date: Fri, 29 Nov 2024 08:57:18 +1100 Subject: [PATCH] fix augmented ops --- M2/Macaulay2/d/evaluate.d | 48 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/M2/Macaulay2/d/evaluate.d b/M2/Macaulay2/d/evaluate.d index f3bfaf394f..6ed49702f4 100644 --- a/M2/Macaulay2/d/evaluate.d +++ b/M2/Macaulay2/d/evaluate.d @@ -1274,34 +1274,32 @@ augmentedAssignmentFun(x:augmentedAssignmentCode):Expr := ( else return r) else return r); -- if not, use default behavior + r:=nullE; + f:=s.binary; if f==dummyBinaryFun then + r=binarymethod(Code(left),x.rhs,SymbolClosure(globalFrame,s)) + else + r=f(Code(left),x.rhs); + when r is e:Error do Expr(e) else ( when x.lhs - is y:globalMemoryReferenceCode do ( - r := s.binary(Code(left), x.rhs); - when r is e:Error do Expr(e) - else globalAssignment(y.frameindex, x.info, r)) - is y:localMemoryReferenceCode do ( - r := s.binary(Code(left), x.rhs); - when r is e:Error do Expr(e) - else localAssignment(y.nestingDepth, y.frameindex, r)) - is y:threadMemoryReferenceCode do ( - r := s.binary(Code(left), x.rhs); - when r is e:Error do Expr(e) - else globalAssignment(y.frameindex, x.info, r)) + is y:globalMemoryReferenceCode do globalAssignment(y.frameindex, x.info, r) + is y:localMemoryReferenceCode do localAssignment(y.nestingDepth, y.frameindex, r) + is y:threadMemoryReferenceCode do globalAssignment(y.frameindex, x.info, r) is y:binaryCode do ( - r := Code(binaryCode(s.binary, Code(left), x.rhs, dummyPosition)); - if y.f == DotS.symbol.binary || y.f == SharpS.symbol.binary - then AssignElemFun(y.lhs, y.rhs, r) - else InstallValueFun(CodeSequence( - convertGlobalOperator(x.info), y.lhs, y.rhs, r))) - is y:adjacentCode do ( - r := Code(binaryCode(s.binary, Code(left), x.rhs, dummyPosition)); - InstallValueFun(CodeSequence( - convertGlobalOperator(AdjacentS.symbol), y.lhs, y.rhs, r))) - is y:unaryCode do ( - r := Code(binaryCode(s.binary, Code(left), x.rhs, dummyPosition)); - UnaryInstallValueFun(convertGlobalOperator(x.info), y.rhs, r)) + if y.f == DotS.symbol.binary || y.f == SharpS.symbol.binary + then AssignElemFun(y.lhs, y.rhs, Code(evaluatedCode(r,dummyPosition))) + else InstallValueFun(CodeSequence( + convertGlobalOperator(x.info), y.lhs, y.rhs, Code(evaluatedCode(r,dummyPosition))))) + is y:ternaryCode do ( + InstallValueFun(CodeSequence( + convertGlobalOperator(x.info), y.arg1, y.arg2, Code(evaluatedCode(r,dummyPosition))))) -- y.arg3 redundant -- combine with previous case? + is y:adjacentCode do ( + InstallValueFun(CodeSequence( + convertGlobalOperator(AdjacentS.symbol), y.lhs, y.rhs, Code(evaluatedCode(r,dummyPosition))))) + is y:unaryCode do ( + UnaryInstallValueFun(convertGlobalOperator(x.info), y.rhs, Code(evaluatedCode(r,dummyPosition)))) else buildErrorPacket( - "augmented assignment not implemented for this code"))); + "augmented assignment not implemented for this code") + ))); ----------------------------------------------------------------------------- steppingFurther(c:Code):bool := steppingFlag && (