When new state blocks are pushed onto the state stack, the loop state is not reset. This causes failures processing nested loops. Try compiling and decompiling this code:
while(true)
{
if (true)
{
if (true)
{
continue;
}
}
for(local i = 0; i <= 10; i++)
{
if (true)
{
continue;
}
else if (true)
{
if (true)
{
}
else
{
}
}
}
}
The output is:
while (true)
{
if (true)
{
if (true)
{
continue;
}
}
local i = 0;
while (i <= 10)
{
if (true)
{
continue;
}
else if (true)
{
if (true)
{
}
else
{
}
}
i++;
}
}
The 'for' loop has changed into an infinite loop. I think when pushing states onto the state stack, the loop flags should be cleared:
// While block found - push loop block
BlockState prevBlockState = state.m_BlockState;
state.m_BlockState.inLoop = BlockState::WhileLoop;
state.m_BlockState.loopFlags = 0; // CLEAR THE LOOP FLAGS
When new state blocks are pushed onto the state stack, the loop state is not reset. This causes failures processing nested loops. Try compiling and decompiling this code:
The output is:
The 'for' loop has changed into an infinite loop. I think when pushing states onto the state stack, the loop flags should be cleared: