Set the symbol->datatpe of function_declaration_c
authorMario de Sousa <msousa@fe.up.pt>
Sun, 13 Jan 2013 16:06:00 +0000
changeset 798 d21e598b0b75
parent 797 3444c331efc9
child 799 214c9dced257
child 805 b737cfc92614
Set the symbol->datatpe of function_declaration_c
stage3/narrow_candidate_datatypes.cc
--- a/stage3/narrow_candidate_datatypes.cc	Sun Jan 13 14:25:38 2013 +0000
+++ b/stage3/narrow_candidate_datatypes.cc	Sun Jan 13 16:06:00 2013 +0000
@@ -716,6 +716,10 @@
 /* B 1.5.1 Functions */
 /*********************/
 void *narrow_candidate_datatypes_c::visit(function_declaration_c *symbol) {
+	/* set the function_declaration_c->datatype to the datatype returned by the function! */
+	symbol->type_name->datatype = search_base_type_c::get_basetype_decl(symbol->type_name);
+	symbol->datatype = symbol->type_name->datatype;
+	
 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
 	symbol->var_declarations_list->accept(*this);
 	if (debug) printf("Narrowing candidate data types list in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);