Skip to content

Commit

Permalink
traverse_pruned_translation: traverse all nodes
Browse files Browse the repository at this point in the history
Fix a bug where some alt nodes were missed by
traverse_pruned_translation().

Fixes vnmakarov#7.
  • Loading branch information
TheCount committed Oct 28, 2018
1 parent eb31c9e commit adfd3ed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/yaep.c
Original file line number Diff line number Diff line change
Expand Up @@ -5255,7 +5255,7 @@ prune_to_minimal (struct yaep_tree_node *node, int *cost)
static void
traverse_pruned_translation (struct yaep_tree_node *node)
{
struct yaep_tree_node *child, *alt;
struct yaep_tree_node *child;
hash_table_entry_t *entry;
int i;

Expand All @@ -5281,8 +5281,11 @@ traverse_pruned_translation (struct yaep_tree_node *node)
node->val.anode.cost = -node->val.anode.cost - 1;
break;
case YAEP_ALT:
for (alt = node; alt != NULL; alt = alt->val.alt.next)
traverse_pruned_translation (alt->val.alt.node);
traverse_pruned_translation (node->val.alt.node);
if (node->val.alt.next != NULL)
{
traverse_pruned_translation (node->val.alt.next);
}
break;
default:
assert (FALSE);
Expand Down

0 comments on commit adfd3ed

Please sign in to comment.