Code cleanup.
authorMario de Sousa <msousa@fe.up.pt>
Mon, 13 Feb 2012 17:04:29 +0000
changeset 442 bd5998ee8876
parent 441 e8de43eefcc5
child 443 ff4d26b7e51d
Code cleanup.
stage3/fill_candidate_datatypes.cc
--- a/stage3/fill_candidate_datatypes.cc	Mon Feb 13 16:29:55 2012 +0000
+++ b/stage3/fill_candidate_datatypes.cc	Mon Feb 13 17:04:29 2012 +0000
@@ -91,16 +91,8 @@
 		param_type = base_type(fp_iterator.param_type());
 		
 		/* check whether one of the candidate_data_types of the value being passed is the same as the param_type */
-			/* TODO
-			 * call  int search_in_datatype_list(symbol_c *datatype, std::vector <symbol_c *> candidate_datatypes);
-			 * instead of using for loop!
-			 */
-		for(i = 0; i < call_param_value->candidate_datatypes.size(); i++) {
-			/* If found (correct data type being passed), then stop the search */
-			if(is_type_equal(param_type, call_param_value->candidate_datatypes[i])) break;
-		}
-		/* if we reached the end of the loop, and no compatible type found, then return false */
-		if (i >= call_param_value->candidate_datatypes.size()) return false;
+		if (search_in_datatype_list(param_type, call_param_value->candidate_datatypes) < 0)
+			return false; /* return false if param_type not in the list! */
 	}
 	/* call is compatible! */
 	return true;
@@ -142,17 +134,8 @@
 		/* Get the parameter type */
 		param_type = base_type(fp_iterator.param_type());
 		/* check whether one of the candidate_data_types of the value being passed is the same as the param_type */
-			/* TODO
-			 * call  int search_in_datatype_list(symbol_c *datatype, std::vector <symbol_c *> candidate_datatypes);
-			 * instead of using for loop!
-			 */
-		for (i = 0; i < call_param_types.size(); i++) {
-			/* If found (correct data type being passed), then stop the search */
-			if(is_type_equal(param_type, call_param_types[i])) break;
-		}
-		/* if we reached the end of the loop, and no compatible type found, then return false */
-		if (i >= call_param_types.size()) return false;
-
+		if (search_in_datatype_list(param_type, call_param_types) < 0)
+			return false; /* return false if param_type not in the list! */
 	}
 	/* call is compatible! */
 	return true;