diff --git a/src/StandardLibraries/StaticScope.cpp b/src/StandardLibraries/StaticScope.cpp index 8d5216d..9e609eb 100644 --- a/src/StandardLibraries/StaticScope.cpp +++ b/src/StandardLibraries/StaticScope.cpp @@ -1,3 +1,11 @@ #include "StaticScope.hpp" -Porygon::StandardLibraries::StaticScope::InternalScope* Porygon::StandardLibraries::StaticScope::_internal = nullptr; \ No newline at end of file +namespace Porygon::StandardLibraries{ + StaticScope::InternalScope* StaticScope::_internal = nullptr; + + extern "C"{ + void RegisterStaticVariable(uint32_t identifier, ScriptType* type, Evaluation::EvalValue* value){ + StaticScope::RegisterVariableRaw(identifier, type, value); + } + } +} diff --git a/src/StandardLibraries/StaticScope.hpp b/src/StandardLibraries/StaticScope.hpp index e5febea..cdf90db 100644 --- a/src/StandardLibraries/StaticScope.hpp +++ b/src/StandardLibraries/StaticScope.hpp @@ -62,6 +62,12 @@ namespace Porygon::StandardLibraries{ GetScope()->_variables.insert({identifier, value}); } + static void RegisterVariableRaw(uint32_t identifier, ScriptType* type, Evaluation::EvalValue* value){ + auto hash = Utilities::HashedString::CreateLookup(identifier); + GetScope()->_boundVariables.insert({hash, new Binder::BoundVariable(shared_ptr(type))}); + GetScope()->_variables.insert({hash, value}); + } + static Binder::BoundVariable* GetBoundVariable(const Utilities::HashedString &identifier){ auto found = GetScope()->_boundVariables.find(identifier); if (found != GetScope()->_boundVariables.end()) {