add global scope

This commit is contained in:
cajun
2024-09-29 14:07:07 -05:00
parent 8709e69bcc
commit ebc4c4fa8d
6 changed files with 39 additions and 8 deletions
+4 -2
View File
@@ -53,7 +53,8 @@ public:
/// Set a variable to a new value (in the current scope)
void setVariable(const String& name, const ScriptValueP& value);
/// Set a variable to a new value (in the current scope)
void setVariable(Variable name, const ScriptValueP& value);
void setVariable(Variable name, const ScriptValueP& value);
void setGlobalVariable(Variable name, const ScriptValueP& value);
/// Get the value of a variable, throws if it not set
ScriptValueP getVariable(const String& name);
@@ -88,7 +89,8 @@ public:// public for FOR_EACH
struct VariableValue {
VariableValue() : level(0) {}
unsigned int level; ///< Scope level on which this variable was set
ScriptValueP value; ///< Value of this variable
ScriptValueP value; ///< Value of this variable
bool global_scope = false; ///< Is this variable globally scoped?
};
/// Record of a variable binding that is being shadowed (overwritten) by another binding
struct Binding {