Skip to content

Commit

Permalink
Resolve parse problem with variables not being removed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
cesaref committed Mar 24, 2021
1 parent 85ff202 commit 645808c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/modules/soul_core/heart/soul_heart_Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ struct FunctionParseState

heart::Function& function;
std::vector<BlockCode> blocks;
std::vector<pool_ref<heart::Variable>> variables;
std::vector<pool_ptr<heart::Variable>> variables;
BlockCode* currentBlock = nullptr;

};
Expand Down Expand Up @@ -754,6 +754,7 @@ struct heart::Parser : public Tokeniser<DummyKeywordMatcher,

resetPosition (b.code);
builder.beginBlock (b.block);
auto variableCount = state.variables.size();
state.setCurrentBlock (b);

try
Expand All @@ -768,6 +769,7 @@ struct heart::Parser : public Tokeniser<DummyKeywordMatcher,
catch (const AbortCompilationException& message)
{
b.block.statements.clear();
state.variables.resize (variableCount);
errors++;
}
}
Expand Down

0 comments on commit 645808c

Please sign in to comment.