Avoid deep tree comparison when both trees have errors

This commit is contained in:
Max Brunsfeld 2017-07-05 17:33:35 -07:00
parent c53f9bcbd9
commit 8f028ebf68
3 changed files with 5 additions and 2 deletions

View file

@ -452,6 +452,8 @@ static bool parser__select_tree(Parser *self, Tree *left, Tree *right) {
return false;
}
if (left->error_cost > 0) return -1;
int comparison = ts_tree_compare(left, right);
switch (comparison) {
case -1: