stage3/fill_candidate_datatypes.cc
changeset 442 bd5998ee8876
parent 441 e8de43eefcc5
child 443 ff4d26b7e51d
equal deleted inserted replaced
441:e8de43eefcc5 442:bd5998ee8876
    89 
    89 
    90 		/* Get the parameter type */
    90 		/* Get the parameter type */
    91 		param_type = base_type(fp_iterator.param_type());
    91 		param_type = base_type(fp_iterator.param_type());
    92 		
    92 		
    93 		/* check whether one of the candidate_data_types of the value being passed is the same as the param_type */
    93 		/* check whether one of the candidate_data_types of the value being passed is the same as the param_type */
    94 			/* TODO
    94 		if (search_in_datatype_list(param_type, call_param_value->candidate_datatypes) < 0)
    95 			 * call  int search_in_datatype_list(symbol_c *datatype, std::vector <symbol_c *> candidate_datatypes);
    95 			return false; /* return false if param_type not in the list! */
    96 			 * instead of using for loop!
       
    97 			 */
       
    98 		for(i = 0; i < call_param_value->candidate_datatypes.size(); i++) {
       
    99 			/* If found (correct data type being passed), then stop the search */
       
   100 			if(is_type_equal(param_type, call_param_value->candidate_datatypes[i])) break;
       
   101 		}
       
   102 		/* if we reached the end of the loop, and no compatible type found, then return false */
       
   103 		if (i >= call_param_value->candidate_datatypes.size()) return false;
       
   104 	}
    96 	}
   105 	/* call is compatible! */
    97 	/* call is compatible! */
   106 	return true;
    98 	return true;
   107 }
    99 }
   108 
   100 
   140 		param_name = fp_iterator.search(call_param_name);
   132 		param_name = fp_iterator.search(call_param_name);
   141 		if(param_name == NULL) return false;
   133 		if(param_name == NULL) return false;
   142 		/* Get the parameter type */
   134 		/* Get the parameter type */
   143 		param_type = base_type(fp_iterator.param_type());
   135 		param_type = base_type(fp_iterator.param_type());
   144 		/* check whether one of the candidate_data_types of the value being passed is the same as the param_type */
   136 		/* check whether one of the candidate_data_types of the value being passed is the same as the param_type */
   145 			/* TODO
   137 		if (search_in_datatype_list(param_type, call_param_types) < 0)
   146 			 * call  int search_in_datatype_list(symbol_c *datatype, std::vector <symbol_c *> candidate_datatypes);
   138 			return false; /* return false if param_type not in the list! */
   147 			 * instead of using for loop!
       
   148 			 */
       
   149 		for (i = 0; i < call_param_types.size(); i++) {
       
   150 			/* If found (correct data type being passed), then stop the search */
       
   151 			if(is_type_equal(param_type, call_param_types[i])) break;
       
   152 		}
       
   153 		/* if we reached the end of the loop, and no compatible type found, then return false */
       
   154 		if (i >= call_param_types.size()) return false;
       
   155 
       
   156 	}
   139 	}
   157 	/* call is compatible! */
   140 	/* call is compatible! */
   158 	return true;
   141 	return true;
   159 }
   142 }
   160 
   143