From d7287914c7f3fad4a0961d638a1256c48e69dd93 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sun, 12 Nov 2017 14:21:49 -0500 Subject: [PATCH] fix arg corruption on functioncall compilation. --- Engine/source/console/astNodes.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index 53e666176..6ea557703 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -1402,6 +1402,8 @@ U32 FuncCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) bool isThisCall = false; + ExprNode *walk = args; + // Try to optimize the this pointer call if it is a variable // that we are loading. if (callType == MethodCall) @@ -1420,11 +1422,11 @@ U32 FuncCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) codeStream.emitSTE(var->varName); // inc args since we took care of first arg. - args = static_cast(args->getNext()); + walk = (ExprNode*)walk ->getNext(); } } - for (ExprNode *walk = args; walk; walk = (ExprNode *)walk->getNext()) + for (; walk; walk = (ExprNode *)walk->getNext()) { TypeReq walkType = walk->getPreferredType(); if (walkType == TypeReqNone) walkType = TypeReqString;