MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / compile

Method compile

Engine/source/console/astNodes.cpp:419–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417//------------------------------------------------------------
418
419U32 ConditionalExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type)
420{
421 // code is testExpr
422 // JMPIFNOT falseStart
423 // trueExpr
424 // JMP end
425 // falseExpr
426 if(testExpr->getPreferredType() == TypeReqUInt)
427 {
428 integer = true;
429 }
430 else
431 {
432 integer = false;
433 }
434
435 ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat);
436 codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT);
437
438 U32 jumpElseIp = codeStream.emit(0);
439 ip = trueExpr->compile(codeStream, ip, type);
440 codeStream.emit(OP_JMP);
441 U32 jumpEndIp = codeStream.emit(0);
442 codeStream.patch(jumpElseIp, codeStream.tell());
443 ip = falseExpr->compile(codeStream, ip, type);
444 codeStream.patch(jumpEndIp, codeStream.tell());
445
446 return codeStream.tell();
447}
448
449TypeReq ConditionalExprNode::getPreferredType()
450{

Callers 5

compileStmtMethod · 0.45
compileSubObjectMethod · 0.45
executeFileFunction · 0.45

Calls 15

conversionOpFunction · 0.85
warnfFunction · 0.85
precompileIdentFunction · 0.85
getCurrentStringTableFunction · 0.85
getCurrentFloatTableFunction · 0.85
getAssignOpTypeOpFunction · 0.85
getPreferredTypeMethod · 0.80
emitMethod · 0.80
patchMethod · 0.80
emitSTEMethod · 0.80
addIntStringMethod · 0.80
addFloatStringMethod · 0.80

Tested by

no test coverage detected