mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- fixed variable's stack offset for implicit dynarray clearing
https://forum.zdoom.org/viewtopic.php?t=66187 https://forum.zdoom.org/viewtopic.php?t=66189 https://forum.zdoom.org/viewtopic.php?t=66198
This commit is contained in:
parent
4fa6678fc5
commit
9a727f6c2f
1 changed files with 9 additions and 8 deletions
|
@ -11292,14 +11292,6 @@ FxExpression *FxLocalVariableDeclaration::Resolve(FCompileContext &ctx)
|
||||||
{
|
{
|
||||||
CHECKRESOLVED();
|
CHECKRESOLVED();
|
||||||
|
|
||||||
if (IsDynamicArray())
|
|
||||||
{
|
|
||||||
auto stackVar = new FxStackVariable(ValueType, StackOffset, ScriptPosition);
|
|
||||||
FArgumentList argsList;
|
|
||||||
clearExpr = new FxMemberFunctionCall(stackVar, "Clear", argsList, ScriptPosition);
|
|
||||||
SAFE_RESOLVE(clearExpr, ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx.Block == nullptr)
|
if (ctx.Block == nullptr)
|
||||||
{
|
{
|
||||||
ScriptPosition.Message(MSG_ERROR, "Variable declaration outside compound statement");
|
ScriptPosition.Message(MSG_ERROR, "Variable declaration outside compound statement");
|
||||||
|
@ -11356,6 +11348,15 @@ FxExpression *FxLocalVariableDeclaration::Resolve(FCompileContext &ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsDynamicArray())
|
||||||
|
{
|
||||||
|
auto stackVar = new FxStackVariable(ValueType, StackOffset, ScriptPosition);
|
||||||
|
FArgumentList argsList;
|
||||||
|
clearExpr = new FxMemberFunctionCall(stackVar, "Clear", argsList, ScriptPosition);
|
||||||
|
SAFE_RESOLVE(clearExpr, ctx);
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Block->LocalVars.Push(this);
|
ctx.Block->LocalVars.Push(this);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue