# HG changeset patch # User Mario de Sousa # Date 1358951403 0 # Node ID 4d71292f87320cf2a7a4453ca2819ef67246b93b # Parent f218434eeaf8f1c9792ed9c57c67ae3097a48b6c Fill symbol->datatype anotation for FB declarations. diff -r f218434eeaf8 -r 4d71292f8732 stage3/fill_candidate_datatypes.cc --- a/stage3/fill_candidate_datatypes.cc Wed Jan 23 13:46:11 2013 +0000 +++ b/stage3/fill_candidate_datatypes.cc Wed Jan 23 14:30:03 2013 +0000 @@ -1293,6 +1293,12 @@ search_varfb_instance_type = NULL; local_enumerated_value_symtable.reset(); + + /* The FB declaration itself may be used as a dataype! We now do the fill algorithm considering + * function_block_declaration_c a data type declaration... + */ + // The next line is essentially equivalent to doing--> symbol->candidate_datatypes.push_back(symbol); + add_datatype_to_candidate_list(symbol, base_type(symbol)); return NULL; } diff -r f218434eeaf8 -r 4d71292f8732 stage3/narrow_candidate_datatypes.cc --- a/stage3/narrow_candidate_datatypes.cc Wed Jan 23 13:46:11 2013 +0000 +++ b/stage3/narrow_candidate_datatypes.cc Wed Jan 23 14:30:03 2013 +0000 @@ -748,6 +748,10 @@ symbol->fblock_body->accept(*this); delete search_varfb_instance_type; search_varfb_instance_type = NULL; + + // A FB declaration can also be used as a Datatype! We now do the narrow algorithm considering it as such! + if (symbol->candidate_datatypes.size() == 1) + symbol->datatype = symbol->candidate_datatypes[0]; return NULL; }