MCPcopy Create free account
hub / github.com/ZDoom/Raze / CheckEmitCast

Method CheckEmitCast

source/common/scripting/backend/codegen.cpp:10180–10212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10178//==========================================================================
10179
10180bool FxVMFunctionCall::CheckEmitCast(VMFunctionBuilder *build, bool returnit, ExpEmit &reg)
10181{
10182 FName funcname = Function->SymbolName;
10183 if (funcname == NAME___decorate_internal_int__ ||
10184 funcname == NAME___decorate_internal_bool__ ||
10185 funcname == NAME___decorate_internal_float__)
10186 {
10187 FxExpression *arg = ArgList[0];
10188 if (returnit)
10189 {
10190 if (arg->isConstant() &&
10191 (funcname == NAME___decorate_internal_int__ ||
10192 funcname == NAME___decorate_internal_bool__))
10193 { // Use immediate version for integers in range
10194 build->EmitRetInt(0, true, static_cast<FxConstant *>(arg)->GetValue().Int);
10195 }
10196 else
10197 {
10198 ExpEmit where = arg->Emit(build);
10199 build->Emit(OP_RET, RET_FINAL, EncodeRegType(where), where.RegNum);
10200 where.Free(build);
10201 }
10202 reg = ExpEmit();
10203 reg.Final = true;
10204 }
10205 else
10206 {
10207 reg = arg->Emit(build);
10208 }
10209 return true;
10210 }
10211 return false;
10212}
10213
10214//==========================================================================
10215//

Callers

nothing calls this directly

Calls 7

EncodeRegTypeFunction · 0.85
ExpEmitClass · 0.85
EmitRetIntMethod · 0.80
isConstantMethod · 0.45
GetValueMethod · 0.45
EmitMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected