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

Method compile

Engine/source/console/codeBlock.cpp:489–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487
488
489bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, const char *inScript, bool overrideNoDso)
490{
491 AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
492
493 // This will return true, but return value is ignored
494 char *script;
495 chompUTF8BOM(inScript, &script);
496
497 gSyntaxError = false;
498 gIsEvalCompile = false;
499 gFuncVars = NULL;
500
501 consoleAllocReset();
502
503 STEtoCode = compileSTEtoCode;
504
505 gStatementList = NULL;
506
507 // Set up the parser.
508 smCurrentParser = getParserForFile(fileName);
509 AssertISV(smCurrentParser, avar("CodeBlock::compile - no parser available for '%s'!", fileName));
510
511 // Now do some parsing.
512 smCurrentParser->setScanBuffer(script, fileName);
513 smCurrentParser->restart(NULL);
514 smCurrentParser->parse();
515
516 if (gSyntaxError)
517 {
518 consoleAllocReset();
519 return false;
520 }
521
522#ifdef TORQUE_NO_DSO_GENERATION
523 if (!overrideNoDso)
524 return false;
525#endif // !TORQUE_NO_DSO_GENERATION
526
527 FileStream st;
528 if (!st.open(codeFileName, Torque::FS::File::Write))
529 return false;
530 st.write(U32(Con::DSOVersion));
531
532 // Reset all our value tables...
533 resetTables();
534
535 smInFunction = false;
536
537 CodeStream codeStream;
538 U32 lastIp;
539 if (gStatementList)
540 {
541 lastIp = compileBlock(gStatementList, codeStream, 0) + 1;
542 }
543 else
544 {
545 codeSize = 1;
546 lastIp = 0;

Callers

nothing calls this directly

Calls 15

isMainThreadFunction · 0.85
chompUTF8BOMFunction · 0.85
consoleAllocResetFunction · 0.85
getParserForFileFunction · 0.85
avarFunction · 0.85
resetTablesFunction · 0.85
compileBlockFunction · 0.85
emitCodeStreamMethod · 0.80
getNumLineBreaksMethod · 0.80
errorfFunction · 0.70
openMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected