summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index 316bcf7d71..addbeefc4b 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -1889,17 +1889,10 @@ parameter_lists_match(exec_list *list_a, exec_list *list_b)
exec_list_iterator iter_a = list_a->iterator();
exec_list_iterator iter_b = list_b->iterator();
- while (iter_a.has_next()) {
+ while (iter_a.has_next() && iter_b.has_next()) {
ir_variable *a = (ir_variable *)iter_a.get();
ir_variable *b = (ir_variable *)iter_b.get();
- /* If all of the parameters from the other parameter list have been
- * exhausted, the lists have different length and, by definition,
- * do not match.
- */
- if (!iter_b.has_next())
- return false;
-
/* If the types of the parameters do not match, the parameters lists
* are different.
*/
@@ -1910,6 +1903,12 @@ parameter_lists_match(exec_list *list_a, exec_list *list_b)
iter_b.next();
}
+ /* Unless both lists are exhausted, they differ in length and, by
+ * definition, do not match.
+ */
+ if (iter_a.has_next() != iter_b.has_next())
+ return false;
+
return true;
}