stage3/narrow_candidate_datatypes.cc
changeset 936 0f7bcc160568
parent 933 76324f461aed
child 937 887e7d90445a
equal deleted inserted replaced
935:be4373d07201 936:0f7bcc160568
  1393   symbol->exp->accept(*this);
  1393   symbol->exp->accept(*this);
  1394   return NULL;
  1394   return NULL;
  1395 }
  1395 }
  1396 
  1396 
  1397 
  1397 
       
  1398 /* SYM_REF1(deref_operator_c, exp)  --> an extension to the IEC 61131-3 standard - based on the IEC 61131-3 v3 standard. Returns address of the varible! */
       
  1399 void *narrow_candidate_datatypes_c::visit(deref_operator_c  *symbol) {
       
  1400   for (unsigned int i = 0; i < symbol->exp->candidate_datatypes.size(); i++) {
       
  1401     /* Determine whether the datatype is a ref_spec_c, as this is the class used as the    */
       
  1402     /* canonical/base datatype of REF_TO types (see search_base_type_c ...)                */ 
       
  1403     ref_spec_c *ref_spec = dynamic_cast<ref_spec_c *>(symbol->exp->candidate_datatypes[i]);
       
  1404     
       
  1405     if ((NULL != ref_spec) && get_datatype_info_c::is_type_equal(ref_spec->type_name, symbol->datatype))
       
  1406       /* if it points to the required datatype for symbol, then that is the required datatype for symbol->exp */
       
  1407       symbol->exp->datatype = ref_spec;
       
  1408   }
       
  1409   
       
  1410   symbol->exp->accept(*this);
       
  1411   return NULL;
       
  1412 }
       
  1413 
       
  1414 
  1398 /* 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! */
  1415 /* 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! */
  1399 void *narrow_candidate_datatypes_c::visit(  ref_expression_c  *symbol) {
  1416 void *narrow_candidate_datatypes_c::visit(  ref_expression_c  *symbol) {
  1400   if (symbol->exp->candidate_datatypes.size() > 0) {
  1417   if (symbol->exp->candidate_datatypes.size() > 0) {
  1401     symbol->exp->datatype = symbol->exp->candidate_datatypes[0]; /* just use the first possible datatype */
  1418     symbol->exp->datatype = symbol->exp->candidate_datatypes[0]; /* just use the first possible datatype */
  1402   }
  1419   }