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

Method compileSubObject

Engine/source/console/astNodes.cpp:1437–1510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1435//------------------------------------------------------------
1436
1437U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root)
1438{
1439 // goes
1440
1441 // OP_PUSHFRAME 1
1442 // name expr
1443 // OP_PUSH 1
1444 // args... PUSH
1445 // OP_CREATE_OBJECT 1
1446 // parentObject 1
1447 // isDatablock 1
1448 // internalName 1
1449 // isSingleton 1
1450 // lineNumber 1
1451 // fail point 1
1452
1453 // for each field, eval
1454 // OP_ADD_OBJECT (to UINT[0]) 1
1455 // root? 1
1456
1457 // add all the sub objects.
1458 // OP_END_OBJECT 1
1459 // root? 1
1460 // To fix the stack issue [7/9/2007 Black]
1461 // OP_FINISH_OBJECT <-- fail point jumps to this opcode
1462
1463 codeStream.emit(OP_PUSH_FRAME);
1464
1465 ip = classNameExpr->compile(codeStream, ip, TypeReqString);
1466 codeStream.emit(OP_PUSH);
1467
1468 ip = objectNameExpr->compile(codeStream, ip, TypeReqString);
1469 codeStream.emit(OP_PUSH);
1470 for(ExprNode *exprWalk = argList; exprWalk; exprWalk = (ExprNode *) exprWalk->getNext())
1471 {
1472 TypeReq walkType = exprWalk->getPreferredType();
1473 if (walkType == TypeReqNone) walkType = TypeReqString;
1474 ip = exprWalk->compile(codeStream, ip, walkType);
1475 switch (exprWalk->getPreferredType())
1476 {
1477 case TypeReqFloat:
1478 codeStream.emit(OP_PUSH_FLT);
1479 break;
1480 case TypeReqUInt:
1481 codeStream.emit(OP_PUSH_UINT);
1482 break;
1483 default:
1484 codeStream.emit(OP_PUSH);
1485 break;
1486 }
1487 }
1488 codeStream.emit(OP_CREATE_OBJECT);
1489 codeStream.emitSTE(parentObject);
1490
1491 codeStream.emit(isDatablock);
1492 codeStream.emit(isClassNameInternal);
1493 codeStream.emit(isSingleton);
1494 codeStream.emit(dbgLineNumber);

Callers

nothing calls this directly

Calls 7

emitMethod · 0.80
getPreferredTypeMethod · 0.80
emitSTEMethod · 0.80
patchMethod · 0.80
compileMethod · 0.45
getNextMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected