1690 /* Fill in the candidate_datatypes lists of all the expressions used in the function call parameters */ |
1690 /* Fill in the candidate_datatypes lists of all the expressions used in the function call parameters */ |
1691 parameter_list->accept(*this); |
1691 parameter_list->accept(*this); |
1692 |
1692 |
1693 /* Look for all compatible function declarations, and add their return datatypes |
1693 /* Look for all compatible function declarations, and add their return datatypes |
1694 * to the candidate_datatype list of this function invocation. |
1694 * to the candidate_datatype list of this function invocation. |
|
1695 * |
|
1696 * If only one function exists, we add its return datatype to the candidate_datatype list, |
|
1697 * even if the parameters passed to it are invalid. |
|
1698 * This guarantees that the remainder of the expression in which the function call is inserted |
|
1699 * is treated as if the function call returns correctly, and therefore does not generate |
|
1700 * spurious error messages. |
|
1701 * Even if the parameters to the function call are invalid, doing this is still safe, as the |
|
1702 * expressions inside the function call will themselves have erros and will guarantee that |
|
1703 * compilation is aborted in stage3. |
1695 */ |
1704 */ |
|
1705 if (function_symtable.multiplicity(symbol->function_name) == 1) { |
|
1706 f_decl = function_symtable.get_value(lower); |
|
1707 returned_parameter_type = base_type(f_decl->type_name); |
|
1708 symbol->candidate_functions.push_back(f_decl); |
|
1709 symbol->candidate_datatypes.push_back(returned_parameter_type); |
|
1710 } |
1696 for(; lower != upper; lower++) { |
1711 for(; lower != upper; lower++) { |
1697 bool compatible = false; |
1712 bool compatible = false; |
1698 |
1713 |
1699 f_decl = function_symtable.get_value(lower); |
1714 f_decl = function_symtable.get_value(lower); |
1700 /* Check if function declaration in symbol_table is compatible with parameters */ |
1715 /* Check if function declaration in symbol_table is compatible with parameters */ |