mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Fix string stack issue returning from a foreach statement.
This commit is contained in:
parent
485330ec7a
commit
f04aca9def
2 changed files with 162 additions and 42 deletions
|
|
@ -1257,9 +1257,9 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
|
|||
{
|
||||
iterStack[--_ITER].mIsStringIter = false;
|
||||
--iterDepth;
|
||||
}
|
||||
|
||||
_STK--; // this is a pop from foreach()
|
||||
_STK--; // this is a pop from foreach()
|
||||
}
|
||||
}
|
||||
|
||||
returnValue.setEmptyString();
|
||||
|
|
@ -1269,61 +1269,48 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
|
|||
|
||||
case OP_RETURN:
|
||||
{
|
||||
if (iterDepth > 0)
|
||||
{
|
||||
// Clear iterator state.
|
||||
while (iterDepth > 0)
|
||||
{
|
||||
iterStack[--_ITER].mIsStringIter = false;
|
||||
--iterDepth;
|
||||
}
|
||||
|
||||
|
||||
const char* retVal = stack[_STK].getString();
|
||||
_STK--;
|
||||
_STK--;
|
||||
stack[_STK + 1].setString(retVal);
|
||||
_STK++; // Not nice but works.
|
||||
}
|
||||
|
||||
returnValue = std::move(stack[_STK]);
|
||||
_STK--;
|
||||
|
||||
// Clear iterator state.
|
||||
while (iterDepth > 0)
|
||||
{
|
||||
iterStack[--_ITER].mIsStringIter = false;
|
||||
--iterDepth;
|
||||
|
||||
_STK--;
|
||||
}
|
||||
|
||||
goto execFinished;
|
||||
}
|
||||
case OP_RETURN_FLT:
|
||||
|
||||
if (iterDepth > 0)
|
||||
{
|
||||
// Clear iterator state.
|
||||
while (iterDepth > 0)
|
||||
{
|
||||
iterStack[--_ITER].mIsStringIter = false;
|
||||
--iterDepth;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
returnValue.setFloat(stack[_STK].getFloat());
|
||||
_STK--;
|
||||
|
||||
// Clear iterator state.
|
||||
while (iterDepth > 0)
|
||||
{
|
||||
iterStack[--_ITER].mIsStringIter = false;
|
||||
--iterDepth;
|
||||
|
||||
_STK--;
|
||||
}
|
||||
|
||||
goto execFinished;
|
||||
|
||||
case OP_RETURN_UINT:
|
||||
|
||||
if (iterDepth > 0)
|
||||
{
|
||||
// Clear iterator state.
|
||||
while (iterDepth > 0)
|
||||
{
|
||||
iterStack[--_ITER].mIsStringIter = false;
|
||||
--iterDepth;
|
||||
}
|
||||
}
|
||||
|
||||
returnValue.setInt(stack[_STK].getInt());
|
||||
_STK--;
|
||||
|
||||
// Clear iterator state.
|
||||
while (iterDepth > 0)
|
||||
{
|
||||
iterStack[--_ITER].mIsStringIter = false;
|
||||
--iterDepth;
|
||||
|
||||
_STK--;
|
||||
}
|
||||
|
||||
goto execFinished;
|
||||
|
||||
case OP_CMPEQ:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue