summaryrefslogtreecommitdiff
path: root/parse/type.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-07-06 00:05:58 -0700
committerOri Bernstein <ori@eigenstate.org>2017-07-06 00:05:58 -0700
commitc75a9bf084fa0a4cda77898cac159c7801edef27 (patch)
tree8016a6782f5839fc6d65e209acb530f6cf2124eb /parse/type.c
parentb5cf804cbeb33a60bea00307c24aa361ea821530 (diff)
downloadmc-c75a9bf084fa0a4cda77898cac159c7801edef27.tar.gz
Remove double recursion.
Diffstat (limited to 'parse/type.c')
-rw-r--r--parse/type.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/parse/type.c b/parse/type.c
index ef0a292..ddd9824 100644
--- a/parse/type.c
+++ b/parse/type.c
@@ -724,6 +724,7 @@ int tyeq_rec(Type *a, Type *b, Bitset *visited, int search)
if (a->tid == b->tid)
return 1;
+
if (bshas(visited, a->tid) || bshas(visited, b->tid))
return 1;
@@ -763,15 +764,13 @@ int tyeq_rec(Type *a, Type *b, Bitset *visited, int search)
for (i = 0; i < a->narg; i++)
if (!tyeq_rec(a->arg[i], b->arg[i], visited, search))
return 0;
- for (i = 0; i < a->nsub; i++)
- if (!tyeq_rec(a->sub[i], b->sub[i], visited, search))
- return 0;
break;
case Tyarray:
if (arraysz(a->asize) != arraysz(b->asize))
return 0;
break;
- default: break;
+ default:
+ break;
}
for (i = 0; i < a->nsub; i++)
if (!tyeq_rec(a->sub[i], b->sub[i], visited, search))