Fix case where loop was created in the parse stack

Fixes #133
This commit is contained in:
Max Brunsfeld 2018-03-01 22:41:53 -08:00
parent 32ef3e001a
commit 82c7e170b3
2 changed files with 40 additions and 5 deletions

View file

@ -167,6 +167,8 @@ static bool stack__tree_is_equivalent(const Tree *left, const Tree *right) {
}
static void stack_node_add_link(StackNode *self, StackLink link) {
if (link.node == self) return;
for (int i = 0; i < self->link_count; i++) {
StackLink existing_link = self->links[i];
if (stack__tree_is_equivalent(existing_link.tree, link.tree)) {