- properly clear all script compiler data for a restart.

This commit is contained in:
Christoph Oelckers 2016-11-07 11:30:41 +01:00
parent dc055b74c1
commit 208fe28042
4 changed files with 10 additions and 16 deletions

View file

@ -213,18 +213,17 @@ void ExpEmit::Reuse(VMFunctionBuilder *build)
// it and install it a local symbol table.
//
//==========================================================================
static PSymbolTable Builtins;
static PSymbol *FindBuiltinFunction(FName funcname, VMNativeFunction::NativeCallType func)
{
PSymbol *sym = Builtins.FindSymbol(funcname, false);
PSymbol *sym = GlobalSymbols.FindSymbol(funcname, false);
if (sym == nullptr)
{
PSymbolVMFunction *symfunc = new PSymbolVMFunction(funcname);
VMNativeFunction *calldec = new VMNativeFunction(func, funcname);
symfunc->Function = calldec;
sym = symfunc;
Builtins.AddSymbol(sym);
GlobalSymbols.AddSymbol(sym);
}
return sym;
}

View file

@ -774,5 +774,5 @@ void FFunctionBuildList::Build()
fclose(dump);
}
FScriptPosition::StrictErrors = false;
mItems.Clear();
}

View file

@ -51,8 +51,6 @@
#include "codegeneration/codegen.h"
#include "vmbuilder.h"
#define DEFINING_CONST ((PSymbolConst *)(void *)1)
//==========================================================================
//
// ZCCCompiler :: ProcessClass
@ -714,10 +712,8 @@ bool ZCCCompiler::CompileConstant(ZCC_ConstantDef *def, PSymbolTable *sym)
{
assert(def->Symbol == nullptr);
def->Symbol = DEFINING_CONST; // avoid recursion
ZCC_Expression *val = Simplify(def->Value, sym, true);
def->Value = val;
if (def->Symbol == DEFINING_CONST) def->Symbol = nullptr;
return (val->NodeType == AST_ExprConstant);
}

View file

@ -199,9 +199,6 @@ static void InitTokenMap()
TOKENDEF (TK_CanRaise, ZCC_CANRAISE);
TOKENDEF (TK_Light, ZCC_LIGHT);
TOKENDEF (TK_Extend, ZCC_EXTEND);
ZCC_InitOperators();
ZCC_InitConversions();
}
#undef TOKENDEF
#undef TOKENDEF2
@ -293,11 +290,6 @@ parse_end:
static void DoParse(int lumpnum)
{
if (TokenMap.CountUsed() == 0)
{
InitTokenMap();
}
FScanner sc;
void *parser;
ZCCToken value;
@ -400,6 +392,13 @@ static void DoParse(int lumpnum)
void ParseScripts()
{
if (TokenMap.CountUsed() == 0)
{
InitTokenMap();
}
ZCC_InitOperators();
ZCC_InitConversions();
int lump, lastlump = 0;
FScriptPosition::ResetErrorCounter();
while ((lump = Wads.FindLump("ZSCRIPT", &lastlump)) != -1)