mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- added the fix for BuiltinNew which I missed when cherry-picking.
This commit is contained in:
parent
ceb38751f0
commit
d60707c71e
1 changed files with 8 additions and 5 deletions
|
@ -5152,6 +5152,11 @@ CVAR(Bool, vm_warnthinkercreation, false, 0)
|
|||
|
||||
static DObject *BuiltinNew(PClass *cls, int outerside, int backwardscompatible)
|
||||
{
|
||||
if (cls == nullptr)
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "New without a class");
|
||||
return nullptr;
|
||||
}
|
||||
if (cls->ConstructNative == nullptr)
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "Class %s requires native construction", cls->TypeName.GetChars());
|
||||
|
@ -5195,8 +5200,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(DObject, BuiltinNew, BuiltinNew)
|
|||
|
||||
ExpEmit FxNew::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
ExpEmit from = val->Emit(build);
|
||||
from.Free(build);
|
||||
ExpEmit to(build, REGT_POINTER);
|
||||
|
||||
// Call DecoRandom to generate a random number.
|
||||
|
@ -5209,14 +5212,14 @@ ExpEmit FxNew::Emit(VMFunctionBuilder *build)
|
|||
FunctionCallEmitter emitters(callfunc);
|
||||
|
||||
int outerside = -1;
|
||||
if (!from.Konst)
|
||||
if (!val->isConstant())
|
||||
{
|
||||
int outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||
if (outerside == FScopeBarrier::Side_Virtual)
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ScopeFlags);
|
||||
}
|
||||
emitters.AddParameter(from, false);
|
||||
emitters.AddParameterIntConst(outerside);
|
||||
emitters.AddParameter(build, val);
|
||||
emitters.AddParameterIntConst(outerside + 1);
|
||||
emitters.AddParameterIntConst(1); // Todo: 1 only if version < 4.0.0
|
||||
emitters.AddReturn(REGT_POINTER);
|
||||
return emitters.EmitCall(build);
|
||||
|
|
Loading…
Reference in a new issue