11#ifndef ARK_COMPILER_LOWERER_LOCALSLOCATOR_HPP
12#define ARK_COMPILER_LOWERER_LOCALSLOCATOR_HPP
40 void addLocal(
const std::string& name);
75 std::vector<std::string>
data;
void saveScopeLengthForBranch()
Save the current scope length before entering a branch, so that we can ignore variable definitions in...
std::vector< Scope > m_scopes
std::vector< std::size_t > m_drop_for_conds
Needed to drop variables inside if/else branches since they don't have their own scope.
std::optional< std::size_t > lookupLastScopeByName(const std::string &name)
Search for a local in the current scope. Returns std::nullopt in case of closure scopes or if the var...
void dropVarsForBranch()
Drop potentially defined variables in the last saved branch.
void deleteScope()
Delete the last scope.
void addLocal(const std::string &name)
Register a local in the current scope, triggered by a STORE instruction. If the local already exists,...
LocalsLocator()
Create a new LocalsLocator to track the position of variables in the scope stack.
void createScope(ScopeType type=ScopeType::Default)
Create a new scope.
std::vector< std::string > data