- separated the code generation from the DECORATE parser and cleaned up the interface to the code generator. Most importantly, the VMScriptFunctions are now preallocated when being added to the list of functions to compile and will be filled in later by the code generator. This allowed the removal of some ugly maintenance code.

This commit is contained in:
Christoph Oelckers 2016-10-13 00:53:59 +02:00
parent 59ed26c0b6
commit a72fbb771f
16 changed files with 287 additions and 274 deletions

View file

@ -26,7 +26,7 @@ public:
VMFunctionBuilder(bool checkself = false);
~VMFunctionBuilder();
VMScriptFunction *MakeFunction();
void MakeFunction(VMScriptFunction *func);
// Returns the constant register holding the value.
int GetConstantInt(int val);
@ -87,4 +87,34 @@ private:
};
void DumpFunction(FILE *dump, VMScriptFunction *sfunc, const char *label, int labellen);
//==========================================================================
//
//
//
//==========================================================================
class FxExpression;
class FFunctionBuildList
{
struct Item
{
PClass *Class = nullptr;
FxExpression *Code = nullptr;
PPrototype *Proto = nullptr;
VMScriptFunction *Function = nullptr;
FString DumpName;
int type; // temporary kludge
};
TArray<Item> mItems;
public:
VMFunction *AddFunction(PClass *cls, FxExpression *code, const FString &name, bool statecall = false);
void Build();
};
extern FFunctionBuildList FunctionBuildList;
#endif