Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (arg_types.size() > other_arg_types.size() || arg_types.empty() && !other_arg_types.empty()) {
- return false;
- }
- size_t index = 0;
- for (size_t arg_t_i = 0; arg_t_i < arg_types.size(); arg_t_i++) {
- const auto & cur_t = arg_types.at(arg_t_i);
- type_ptr vararg_t = cur_t->tag == TypeTag::VarargTag ? cur_t : nullptr;
- if (vararg_t) {
- const auto & cmp_t = other_arg_types.at(index);
- while (index < other_arg_types.size() && vararg_t->compare(other_arg_types.at(index))) {
- index++;
- }
- // If next type after vararg is the same as vararg_t, go to previous type
- if (arg_t_i + 1 < arg_types.size()
- && vararg_t->compare(arg_types.at(arg_t_i + 1))) {
- index--;
- }
- } else if (!cur_t->compare(other_arg_types.at(index))) {
- return false;
- } else {
- // Go to next if not vararg and type was right
- index++;
- }
- // Go to next type for comparison
- arg_t_i++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement