diff -r 061824c45a5b -r 76324f461aed stage3/fill_candidate_datatypes.cc --- a/stage3/fill_candidate_datatypes.cc Sat Sep 27 20:09:19 2014 +0100 +++ b/stage3/fill_candidate_datatypes.cc Sun Sep 28 16:35:44 2014 +0100 @@ -1889,9 +1889,26 @@ /***********************/ /* B 3.1 - Expressions */ /***********************/ +/* SYM_REF1(deref_expression_c, exp) --> an extension to the IEC 61131-3 standard - based on the IEC 61131-3 v3 standard. Returns address of the varible! */ +void *fill_candidate_datatypes_c::visit(deref_expression_c *symbol) { + symbol->exp->accept(*this); + + for (unsigned int i = 0; i < symbol->exp->candidate_datatypes.size(); i++) { + /* Determine whether the datatype is a ref_spec_c, as this is the class used as the */ + /* canonical/base datatype of REF_TO types (see search_base_type_c ...) */ + ref_spec_c *ref_spec = dynamic_cast(symbol->exp->candidate_datatypes[i]); + + if (NULL != ref_spec) + add_datatype_to_candidate_list(symbol, ref_spec->type_name); + } + + return NULL; +} + + /* SYM_REF1(ref_expression_c, exp) --> an extension to the IEC 61131-3 standard - based on the IEC 61131-3 v3 standard. Returns address of the varible! */ void *fill_candidate_datatypes_c::visit( ref_expression_c *symbol) { - /* We must first determine the datatype of the expression passe to the REF() operator, with no ambiguities! + /* We must first determine the datatype of the expression passed to the REF() operator, with no ambiguities! * To do this, we could use the complete standard fill/narrow algorithm for determining the datatype * of the expression. This is actually possible, as nothing stops us from directly calling the narrow_candidate_datatypes_c * from this method inside fill_candidate_datatypes_c, to complete the fill/narrow algorithm on this @@ -1910,9 +1927,8 @@ if (symbol->exp->candidate_datatypes.size() == 1) symbol->exp->datatype = symbol->exp->candidate_datatypes[0]; - /* Create a new object of ref_spec_c, as this is the class used as the canonical/base datatype of REF_TO types - * (see search_base_type_c ...) - */ + /* Create a new object of ref_spec_c, as this is the class used as the */ + /* canonical/base datatype of REF_TO types (see search_base_type_c ...) */ ref_spec_c *ref_spec = new ref_spec_c(symbol->exp->datatype); add_datatype_to_candidate_list(symbol, ref_spec); return NULL;