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

Method compile

Engine/source/console/astNodes.cpp:370–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368//------------------------------------------------------------
369
370U32 ConditionalExprNode::compile(CodeStream& codeStream, U32 ip, TypeReq type)
371{
372 // code is testExpr
373 // JMPIFNOT falseStart
374 // trueExpr
375 // JMP end
376 // falseExpr
377 if (testExpr->getPreferredType() == TypeReqUInt)
378 {
379 integer = true;
380 }
381 else
382 {
383 integer = false;
384 }
385
386 ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat);
387 codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT);
388
389 U32 jumpElseIp = codeStream.emit(0);
390 ip = trueExpr->compile(codeStream, ip, type);
391 codeStream.emit(OP_JMP);
392 U32 jumpEndIp = codeStream.emit(0);
393 codeStream.patch(jumpElseIp, codeStream.tell());
394 ip = falseExpr->compile(codeStream, ip, type);
395 codeStream.patch(jumpEndIp, codeStream.tell());
396
397 return codeStream.tell();
398}
399
400TypeReq ConditionalExprNode::getPreferredType()
401{

Callers 6

util.pyFile · 0.45
compileStmtMethod · 0.45
compileSubObjectMethod · 0.45
executeFileFunction · 0.45

Calls 15

precompileIdentFunction · 0.85
getFuncVarsFunction · 0.85
getCurrentStringTableFunction · 0.85
getCurrentFloatTableFunction · 0.85
getAssignOpTypeOpFunction · 0.85
getPreferredTypeMethod · 0.80
patchMethod · 0.80
emitSTEMethod · 0.80
addIntStringMethod · 0.80
addFloatStringMethod · 0.80
warnfFunction · 0.70
consoleStringToNumberFunction · 0.70

Tested by

no test coverage detected