Skip to content
Snippets Groups Projects
Commit cb888d72 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Fix a vicious bug in symbol table management

Functions identifiers are also stored in symbol tables.
When a block of code is left, all local variables are reset to avoid
useless memory consumption.

The problem was that locally defined functions lost their associate id
which is necessary to retrieve the function in the function
table. When a function was defined in a block, its id were set to 0...

Now functions identifiers are no more clean-up.
parent 150aadc1
Branches
Tags
1 merge request!77Fix a vicious bug in symbol table management
......@@ -267,6 +267,8 @@ class SymbolTable
clearValues()
{
for (auto& symbol : m_symbol_list) {
// local functions must kept their values (id)
if (symbol.attributes().dataType() != ASTNodeDataType::function_t) {
std::visit(
[](auto&& value) {
using T = std::decay_t<decltype(value)>;
......@@ -275,6 +277,7 @@ class SymbolTable
symbol.attributes().value());
}
}
}
auto
find(const std::string& symbol, const TAO_PEGTL_NAMESPACE::position& use_position)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment