Merge all versions created in a given reduce operation

This commit is contained in:
Max Brunsfeld 2016-04-24 00:55:19 -07:00
parent fe74c6fb34
commit e99a3925e0
3 changed files with 12 additions and 3 deletions

View file

@ -342,6 +342,7 @@ static Reduction ts_parser__reduce(TSParser *self, StackVersion version,
count, BOOL_STRING(fragile));
}
size_t initial_version_count = ts_stack_version_count(self->stack);
StackPopResult pop = ts_stack_pop_count(self->stack, version, count);
switch (pop.status) {
case StackPopFailed:
@ -414,6 +415,8 @@ static Reduction ts_parser__reduce(TSParser *self, StackVersion version,
}
}
ts_stack_merge_from(self->stack, initial_version_count);
return (Reduction){ ReduceSucceeded, pop.slices.contents[0] };
error: