1067 return NULL; |
1067 return NULL; |
1068 |
1068 |
1069 symbol_c *return_data_type = NULL; |
1069 symbol_c *return_data_type = NULL; |
1070 symbol_c* fdecl_return_type; |
1070 symbol_c* fdecl_return_type; |
1071 symbol_c* overloaded_data_type = NULL; |
1071 symbol_c* overloaded_data_type = NULL; |
|
1072 int extensible_param_count = -1; |
1072 symbol->called_function_declaration = NULL; |
1073 symbol->called_function_declaration = NULL; |
1073 |
1074 |
1074 /* First find the declaration of the function being called! */ |
1075 /* First find the declaration of the function being called! */ |
1075 function_symtable_t::iterator lower = function_symtable.lower_bound(symbol->function_name); |
1076 function_symtable_t::iterator lower = function_symtable.lower_bound(symbol->function_name); |
1076 function_symtable_t::iterator upper = function_symtable.upper_bound(symbol->function_name); |
1077 function_symtable_t::iterator upper = function_symtable.upper_bound(symbol->function_name); |
1098 */ |
1099 */ |
1099 |
1100 |
1100 fdecl_return_type = base_type(f_decl->type_name); |
1101 fdecl_return_type = base_type(f_decl->type_name); |
1101 |
1102 |
1102 if (symbol->called_function_declaration == NULL) { |
1103 if (symbol->called_function_declaration == NULL) { |
1103 /* Store the pointer to the declaration of the function being called. |
1104 /* Store the pointer to the declaration of the function being called. |
1104 * This data will be used by stage 4 to call the correct function. |
1105 * This data will be used by stage 4 to call the correct function. |
1105 * Mostly needed to disambiguate overloaded functions... |
1106 * Mostly needed to disambiguate overloaded functions... |
1106 * See comments in absyntax.def for more details |
1107 * See comments in absyntax.def for more details |
1107 */ |
1108 */ |
1108 symbol->called_function_declaration = f_decl; |
1109 symbol->called_function_declaration = f_decl; |
1109 |
1110 extensible_param_count = symbol->extensible_param_count; |
1110 /* determine the base data type returned by the function being called... */ |
1111 |
1111 return_data_type = fdecl_return_type; |
1112 /* determine the base data type returned by the function being called... */ |
1112 } |
1113 return_data_type = fdecl_return_type; |
1113 else if (typeid(*return_data_type) != typeid(*fdecl_return_type)){ |
1114 } |
1114 return_data_type = common_literal(return_data_type, fdecl_return_type); |
1115 else if (typeid(*return_data_type) != typeid(*fdecl_return_type)){ |
1115 overloaded_data_type = overloaded_return_type(return_data_type); |
1116 return_data_type = common_literal(return_data_type, fdecl_return_type); |
1116 } |
1117 overloaded_data_type = overloaded_return_type(return_data_type); |
|
1118 } |
1117 |
1119 |
1118 if (NULL == return_data_type) ERROR; |
1120 if (NULL == return_data_type) ERROR; |
1119 } |
1121 } |
1120 } |
1122 } |
1121 |
1123 |
1135 * This data will be used by stage 4 to call the correct function. |
1137 * This data will be used by stage 4 to call the correct function. |
1136 * Mostly needed to disambiguate overloaded functions... |
1138 * Mostly needed to disambiguate overloaded functions... |
1137 * See comments in absyntax.def for more details |
1139 * See comments in absyntax.def for more details |
1138 */ |
1140 */ |
1139 symbol->called_function_declaration = f_decl; |
1141 symbol->called_function_declaration = f_decl; |
|
1142 extensible_param_count = symbol->extensible_param_count; |
1140 } |
1143 } |
1141 } |
1144 } |
1142 } |
1145 } |
1143 } |
1146 } |
1144 |
1147 |
1145 if (NULL == return_data_type) { |
1148 if (NULL == return_data_type) { |
1146 /* No compatible function was found for this function call */ |
1149 /* No compatible function was found for this function call */ |
1147 STAGE3_ERROR(symbol, symbol, "Call to an overloaded function with invalid parameter type."); |
1150 STAGE3_ERROR(symbol, symbol, "Call to an overloaded function with invalid parameter type."); |
1148 } |
1151 } |
1149 else { |
1152 else { |
|
1153 symbol->extensible_param_count = extensible_param_count; |
1150 /* set the new data type of the default variable for the following verifications... */ |
1154 /* set the new data type of the default variable for the following verifications... */ |
1151 il_default_variable_type = return_data_type; |
1155 il_default_variable_type = return_data_type; |
1152 } |
1156 } |
1153 |
1157 |
1154 return NULL; |
1158 return NULL; |
1271 return NULL; |
1275 return NULL; |
1272 |
1276 |
1273 symbol_c *return_data_type = NULL; |
1277 symbol_c *return_data_type = NULL; |
1274 symbol_c* fdecl_return_type; |
1278 symbol_c* fdecl_return_type; |
1275 symbol_c *overloaded_data_type = NULL; |
1279 symbol_c *overloaded_data_type = NULL; |
|
1280 int extensible_param_count = -1; |
1276 symbol->called_function_declaration = NULL; |
1281 symbol->called_function_declaration = NULL; |
1277 |
1282 |
1278 function_symtable_t::iterator lower = function_symtable.lower_bound(symbol->function_name); |
1283 function_symtable_t::iterator lower = function_symtable.lower_bound(symbol->function_name); |
1279 function_symtable_t::iterator upper = function_symtable.upper_bound(symbol->function_name); |
1284 function_symtable_t::iterator upper = function_symtable.upper_bound(symbol->function_name); |
1280 function_symtable_t::iterator current; |
1285 function_symtable_t::iterator current; |
1313 * This data will be used by stage 4 to call the correct function. |
1318 * This data will be used by stage 4 to call the correct function. |
1314 * Mostly needed to disambiguate overloaded functions... |
1319 * Mostly needed to disambiguate overloaded functions... |
1315 * See comments in absyntax.def for more details |
1320 * See comments in absyntax.def for more details |
1316 */ |
1321 */ |
1317 symbol->called_function_declaration = f_decl; |
1322 symbol->called_function_declaration = f_decl; |
|
1323 extensible_param_count = symbol->extensible_param_count; |
1318 |
1324 |
1319 /* determine the base data type returned by the function being called... */ |
1325 /* determine the base data type returned by the function being called... */ |
1320 return_data_type = fdecl_return_type; |
1326 return_data_type = fdecl_return_type; |
1321 } |
1327 } |
1322 else if (typeid(*return_data_type) != typeid(*fdecl_return_type)){ |
1328 else if (typeid(*return_data_type) != typeid(*fdecl_return_type)){ |
1346 * This data will be used by stage 4 to call the correct function. |
1352 * This data will be used by stage 4 to call the correct function. |
1347 * Mostly needed to disambiguate overloaded functions... |
1353 * Mostly needed to disambiguate overloaded functions... |
1348 * See comments in absyntax.def for more details |
1354 * See comments in absyntax.def for more details |
1349 */ |
1355 */ |
1350 symbol->called_function_declaration = f_decl; |
1356 symbol->called_function_declaration = f_decl; |
|
1357 extensible_param_count = symbol->extensible_param_count; |
1351 } |
1358 } |
1352 } |
1359 } |
1353 } |
1360 } |
1354 } |
1361 } |
1355 |
1362 |
1356 if (NULL == return_data_type) { |
1363 if (NULL == return_data_type) { |
1357 /* No compatible function was found for this function call */ |
1364 /* No compatible function was found for this function call */ |
1358 STAGE3_ERROR(symbol, symbol, "Call to an overloaded function with invalid parameter type."); |
1365 STAGE3_ERROR(symbol, symbol, "Call to an overloaded function with invalid parameter type."); |
1359 } |
1366 } |
1360 else { |
1367 else { |
|
1368 symbol->extensible_param_count = extensible_param_count; |
1361 /* the data type of the data returned by the function, and stored in the il default variable... */ |
1369 /* the data type of the data returned by the function, and stored in the il default variable... */ |
1362 il_default_variable_type = return_data_type; |
1370 il_default_variable_type = return_data_type; |
1363 } |
1371 } |
1364 |
1372 |
1365 return NULL; |
1373 return NULL; |
2117 if (lower == function_symtable.end()) ERROR; |
2125 if (lower == function_symtable.end()) ERROR; |
2118 |
2126 |
2119 symbol_c* return_data_type; |
2127 symbol_c* return_data_type; |
2120 symbol_c* fdecl_return_type; |
2128 symbol_c* fdecl_return_type; |
2121 symbol_c* overloaded_data_type = NULL; |
2129 symbol_c* overloaded_data_type = NULL; |
|
2130 int extensible_param_count = -1; |
2122 symbol->called_function_declaration = NULL; |
2131 symbol->called_function_declaration = NULL; |
2123 |
2132 |
2124 function_symtable_t::iterator second = lower; |
2133 function_symtable_t::iterator second = lower; |
2125 second++; |
2134 second++; |
2126 if (second == upper) { |
2135 if (second == upper) { |
2158 * This data will be used by stage 4 to call the correct function. |
2167 * This data will be used by stage 4 to call the correct function. |
2159 * Mostly needed to disambiguate overloaded functions... |
2168 * Mostly needed to disambiguate overloaded functions... |
2160 * See comments in absyntax.def for more details |
2169 * See comments in absyntax.def for more details |
2161 */ |
2170 */ |
2162 symbol->called_function_declaration = f_decl; |
2171 symbol->called_function_declaration = f_decl; |
|
2172 extensible_param_count = symbol->extensible_param_count; |
2163 |
2173 |
2164 /* determine the base data type returned by the function being called... */ |
2174 /* determine the base data type returned by the function being called... */ |
2165 return_data_type = fdecl_return_type; |
2175 return_data_type = fdecl_return_type; |
2166 } |
2176 } |
2167 else if (typeid(*return_data_type) != typeid(*fdecl_return_type)){ |
2177 else if (typeid(*return_data_type) != typeid(*fdecl_return_type)){ |
2188 * This data will be used by stage 4 to call the correct function. |
2198 * This data will be used by stage 4 to call the correct function. |
2189 * Mostly needed to disambiguate overloaded functions... |
2199 * Mostly needed to disambiguate overloaded functions... |
2190 * See comments in absyntax.def for more details |
2200 * See comments in absyntax.def for more details |
2191 */ |
2201 */ |
2192 symbol->called_function_declaration = f_decl; |
2202 symbol->called_function_declaration = f_decl; |
|
2203 extensible_param_count = symbol->extensible_param_count; |
2193 } |
2204 } |
2194 } |
2205 } |
2195 } |
2206 } |
2196 } |
2207 } |
2197 |
2208 |
2198 if (return_data_type != NULL) |
2209 if (return_data_type != NULL) { |
2199 return return_data_type; |
2210 symbol->extensible_param_count = extensible_param_count; |
|
2211 return return_data_type; |
|
2212 } |
2200 |
2213 |
2201 /* No compatible function was found for this function call */ |
2214 /* No compatible function was found for this function call */ |
2202 STAGE3_ERROR(symbol, symbol, "Call to an overloaded function with invalid parameter type."); |
2215 STAGE3_ERROR(symbol, symbol, "Call to an overloaded function with invalid parameter type."); |
2203 return NULL; |
2216 return NULL; |
2204 } |
2217 } |