diff --git a/src/n8/core/SymbolTable.cpp b/src/n8/core/SymbolTable.cpp index ea96b8b..5729134 100644 --- a/src/n8/core/SymbolTable.cpp +++ b/src/n8/core/SymbolTable.cpp @@ -79,6 +79,16 @@ void SymbolTable::setSymbol( else this->table[name] = std::move(value); } +void SymbolTable::removeSymbol(std::string name) { + if(this->parent && this->parent->hasSymbol(name)) { + this->parent->removeSymbol(name); + return; + } + + if(this->hasSymbol(name) && !this->table[name].hasLock()) + this->table.erase(name); +} + void SymbolTable::removeSymbol(std::shared_ptr name) { std::string symbol = name->getImage(); if(this->parent && this->parent->hasSymbol(symbol)) {