mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Allow local variables to be used in eval.
This commit is contained in:
parent
5137e54a7c
commit
2d50f52cf1
5 changed files with 90 additions and 54 deletions
|
|
@ -276,6 +276,35 @@ namespace Compiler
|
|||
void consoleAllocReset();
|
||||
|
||||
extern bool gSyntaxError;
|
||||
extern bool gIsEvalCompile;
|
||||
};
|
||||
|
||||
class FuncVars
|
||||
{
|
||||
struct Var
|
||||
{
|
||||
S32 reg;
|
||||
TypeReq currentType;
|
||||
StringTableEntry name;
|
||||
bool isConstant;
|
||||
};
|
||||
|
||||
public:
|
||||
S32 assign(StringTableEntry var, TypeReq currentType, S32 lineNumber, bool isConstant = false);
|
||||
|
||||
S32 lookup(StringTableEntry var, S32 lineNumber);
|
||||
|
||||
TypeReq lookupType(StringTableEntry var, S32 lineNumber);
|
||||
|
||||
inline S32 count() { return counter; }
|
||||
|
||||
std::unordered_map<S32, StringTableEntry> variableNameMap;
|
||||
|
||||
void clear();
|
||||
|
||||
private:
|
||||
std::unordered_map<StringTableEntry, Var> vars;
|
||||
S32 counter = 0;
|
||||
};
|
||||
|
||||
/// Utility class to emit and patch bytecode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue