mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +00:00
- fixed code generation for if statements with empty 'true' part. For those the jump statement backpatching was not done correctly.
This commit is contained in:
parent
8dd91f7129
commit
1fa37aaeb7
1 changed files with 7 additions and 4 deletions
|
@ -8955,7 +8955,7 @@ ExpEmit FxIfStatement::Emit(VMFunctionBuilder *build)
|
||||||
size_t jumpspot = ~0u;
|
size_t jumpspot = ~0u;
|
||||||
|
|
||||||
TArray<size_t> yes, no;
|
TArray<size_t> yes, no;
|
||||||
Condition->EmitCompare(build, false, yes, no);
|
Condition->EmitCompare(build, WhenTrue == nullptr, yes, no);
|
||||||
|
|
||||||
if (WhenTrue != nullptr)
|
if (WhenTrue != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -8964,11 +8964,14 @@ ExpEmit FxIfStatement::Emit(VMFunctionBuilder *build)
|
||||||
}
|
}
|
||||||
if (WhenFalse != nullptr)
|
if (WhenFalse != nullptr)
|
||||||
{
|
{
|
||||||
if (WhenTrue != nullptr && !WhenTrue->CheckReturn()) jumpspot = build->Emit(OP_JMP, 0); // no need to emit a jump if the block returns.
|
if (WhenTrue != nullptr)
|
||||||
build->BackpatchListToHere(no);
|
{
|
||||||
|
if (!WhenTrue->CheckReturn()) jumpspot = build->Emit(OP_JMP, 0); // no need to emit a jump if the block returns.
|
||||||
|
build->BackpatchListToHere(no);
|
||||||
|
}
|
||||||
WhenFalse->EmitStatement(build);
|
WhenFalse->EmitStatement(build);
|
||||||
if (jumpspot != ~0u) build->BackpatchToHere(jumpspot);
|
if (jumpspot != ~0u) build->BackpatchToHere(jumpspot);
|
||||||
if (WhenTrue == nullptr) build->BackpatchListToHere(yes);
|
if (WhenTrue == nullptr) build->BackpatchListToHere(no);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue