Skip to content

Commit 645808c

Browse files
committed
Resolve parse problem with variables not being removed correctly
1 parent 85ff202 commit 645808c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

source/modules/soul_core/heart/soul_heart_Parser.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ struct FunctionParseState
116116

117117
heart::Function& function;
118118
std::vector<BlockCode> blocks;
119-
std::vector<pool_ref<heart::Variable>> variables;
119+
std::vector<pool_ptr<heart::Variable>> variables;
120120
BlockCode* currentBlock = nullptr;
121121

122122
};
@@ -754,6 +754,7 @@ struct heart::Parser : public Tokeniser<DummyKeywordMatcher,
754754

755755
resetPosition (b.code);
756756
builder.beginBlock (b.block);
757+
auto variableCount = state.variables.size();
757758
state.setCurrentBlock (b);
758759

759760
try
@@ -768,6 +769,7 @@ struct heart::Parser : public Tokeniser<DummyKeywordMatcher,
768769
catch (const AbortCompilationException& message)
769770
{
770771
b.block.statements.clear();
772+
state.variables.resize (variableCount);
771773
errors++;
772774
}
773775
}

0 commit comments

Comments
 (0)