#ifndef PORYGONLANG_BOUNDSCOPE_HPP #define PORYGONLANG_BOUNDSCOPE_HPP #include #include #include #include #include "BoundVariable.hpp" #include "BoundVariableKey.hpp" #include "VariableAssigmentResult.hpp" #include "../../Utilities/HashedString.hpp" using namespace std; namespace Porygon::Binder { class BoundScope { unordered_map *_tableScope; vector *> _localScope; int _currentScope; int _lastCreatedScope; public: explicit BoundScope(unordered_map *tableScope); ~BoundScope(); void GoInnerScope(); void GoOuterScope(); int Exists(int key); BoundVariable *GetVariable(uint32_t scope, uint32_t identifier); VariableAssignment CreateExplicitLocal(uint32_t identifier, std::shared_ptr type); VariableAssignment AssignVariable(uint32_t identifier, const std::shared_ptr &type); size_t GetLocalVariableCount() { return _localScope.size(); } int GetCurrentScope() { return _currentScope; } }; } #endif //PORYGONLANG_BOUNDSCOPE_HPP