mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Optionally allow to treat script assert as warning
This commit allows us to treat variable use before assign errors and local variables inside of the global scope as warnings instead of asserts. This will allow for easier porting of legacy scripts. It is highly recommended use this as an aid to port scripts, but can be used in production if needbe.
This commit is contained in:
parent
b5bd242e23
commit
2e03108856
6 changed files with 60 additions and 12 deletions
|
|
@ -38,6 +38,7 @@ CodeBlock * CodeBlock::smCurrentCodeBlock = NULL;
|
|||
ConsoleParser *CodeBlock::smCurrentParser = NULL;
|
||||
|
||||
extern FuncVars gEvalFuncVars;
|
||||
extern FuncVars gGlobalScopeFuncVars;
|
||||
extern FuncVars* gFuncVars;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
@ -637,8 +638,7 @@ ConsoleValue CodeBlock::compileExec(StringTableEntry fileName, const char *inStr
|
|||
|
||||
// we are an eval compile if we don't have a file name associated (no exec)
|
||||
gIsEvalCompile = fileName == NULL;
|
||||
// In eval mode, global func vars are allowed.
|
||||
gFuncVars = gIsEvalCompile ? &gEvalFuncVars : NULL;
|
||||
gFuncVars = gIsEvalCompile ? &gEvalFuncVars : &gGlobalScopeFuncVars;
|
||||
|
||||
// Set up the parser.
|
||||
smCurrentParser = getParserForFile(fileName);
|
||||
|
|
@ -678,7 +678,7 @@ ConsoleValue CodeBlock::compileExec(StringTableEntry fileName, const char *inStr
|
|||
codeStream.emit(OP_RETURN_VOID);
|
||||
codeStream.emitCodeStream(&codeSize, &code, &lineBreakPairs);
|
||||
|
||||
S32 localRegisterCount = gIsEvalCompile ? gEvalFuncVars.count() : 0;
|
||||
S32 localRegisterCount = gIsEvalCompile ? gEvalFuncVars.count() : gGlobalScopeFuncVars.count();
|
||||
|
||||
consoleAllocReset();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue