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

Method compileSubObject

Engine/source/console/astNodes.cpp:1397–1464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1395//------------------------------------------------------------
1396
1397U32 ObjectDeclNode::compileSubObject(CodeStream& codeStream, U32 ip, bool root)
1398{
1399 // goes
1400
1401 // OP_PUSHFRAME 1
1402 // name expr
1403 // OP_PUSH 1
1404 // args... PUSH
1405 // OP_CREATE_OBJECT 1
1406 // parentObject 1
1407 // isDatablock 1
1408 // internalName 1
1409 // isSingleton 1
1410 // lineNumber 1
1411 // fail point 1
1412
1413 // for each field, eval
1414 // OP_ADD_OBJECT (to UINT[0]) 1
1415 // root? 1
1416
1417 // add all the sub objects.
1418 // OP_END_OBJECT 1
1419 // root? 1
1420 // To fix the stack issue [7/9/2007 Black]
1421 // OP_FINISH_OBJECT <-- fail point jumps to this opcode
1422
1423 S32 count = 2; // 2 OP_PUSH's
1424 for (ExprNode* exprWalk = argList; exprWalk; exprWalk = (ExprNode*)exprWalk->getNext())
1425 count++;
1426
1427 codeStream.emit(OP_PUSH_FRAME);
1428 codeStream.emit(count);
1429
1430 ip = classNameExpr->compile(codeStream, ip, TypeReqString);
1431 codeStream.emit(OP_PUSH);
1432
1433 ip = objectNameExpr->compile(codeStream, ip, TypeReqString);
1434 codeStream.emit(OP_PUSH);
1435 for (ExprNode* exprWalk = argList; exprWalk; exprWalk = (ExprNode*)exprWalk->getNext())
1436 {
1437 TypeReq walkType = exprWalk->getPreferredType();
1438 if (walkType == TypeReqNone) walkType = TypeReqString;
1439 ip = exprWalk->compile(codeStream, ip, walkType);
1440 codeStream.emit(OP_PUSH);
1441 }
1442 codeStream.emit(OP_CREATE_OBJECT);
1443 codeStream.emitSTE(parentObject);
1444
1445 codeStream.emit(isDatablock);
1446 codeStream.emit(isClassNameInternal);
1447 codeStream.emit(isSingleton);
1448 codeStream.emit(dbgLineNumber);
1449 const U32 failIp = codeStream.emit(0);
1450 for (SlotAssignNode* slotWalk = slotDecls; slotWalk; slotWalk = (SlotAssignNode*)slotWalk->getNext())
1451 ip = slotWalk->compile(codeStream, ip, TypeReqNone);
1452 codeStream.emit(OP_ADD_OBJECT);
1453 codeStream.emit(root);
1454 for (ObjectDeclNode* objectWalk = subObjects; objectWalk; objectWalk = (ObjectDeclNode*)objectWalk->getNext())

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected