mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
- fixed: an 'if' that gets completely optimized away by a constant 'false' condition should not make the entire function disappear.
This commit is contained in:
parent
0cbdb9ab72
commit
58002f7f96
2 changed files with 20 additions and 0 deletions
|
@ -997,6 +997,25 @@ public:
|
|||
void SetFunction(VMScriptFunction *func) { MyFunction = func; }
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
class FxNop : public FxExpression
|
||||
{
|
||||
public:
|
||||
FxNop(const FScriptPosition &p)
|
||||
: FxExpression(p)
|
||||
{
|
||||
isresolved = true;
|
||||
}
|
||||
ExpEmit Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
return ExpEmit();
|
||||
}
|
||||
};
|
||||
|
||||
FxExpression *ParseExpression (FScanner &sc, PClassActor *cls, bool mustresolve = false);
|
||||
|
||||
|
|
|
@ -3648,6 +3648,7 @@ FxExpression *FxIfStatement::Resolve(FCompileContext &ctx)
|
|||
FxExpression *e = result ? WhenTrue : WhenFalse;
|
||||
delete (result ? WhenFalse : WhenTrue);
|
||||
WhenTrue = WhenFalse = NULL;
|
||||
if (e == NULL) e = new FxNop(ScriptPosition); // create a dummy if this statement gets completely removed by optimizing out the constant parts.
|
||||
delete this;
|
||||
return e;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue