- allow temporary strings to be used as self pointer for String's member functions.

Due to how function calls get resolved by the code generator there were some incorrect flags on the self pointer which triggered an assert and caused incorrect code generation.
Fortunately this was a mostly contained special case for which a workaround was possible.
This commit is contained in:
Christoph Oelckers 2018-07-20 10:38:55 +02:00
parent 4a7b1aada7
commit 2a0c3e63a3
1 changed files with 2 additions and 2 deletions

View File

@ -9057,7 +9057,7 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build)
{
assert(Self != nullptr);
selfemit = Self->Emit(build);
assert((selfemit.RegType == REGT_POINTER) || (selfemit.Fixed && selfemit.Target));
assert(selfemit.RegType == REGT_POINTER || selfemit.RegType == REGT_STRING || (selfemit.Fixed && selfemit.Target));
int innerside = FScopeBarrier::SideFromFlags(Function->Variants[0].Flags);
@ -9077,7 +9077,7 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build)
}
}
if (selfemit.Fixed && selfemit.Target)
if ((selfemit.Fixed && selfemit.Target) || selfemit.RegType == REGT_STRING)
{
// Address of a local variable.
build->Emit(OP_PARAM, 0, selfemit.RegType | REGT_ADDROF, selfemit.RegNum);