1376 /* B.3 - Language ST (Structured Text) */ |
1376 /* B.3 - Language ST (Structured Text) */ |
1377 /***************************************/ |
1377 /***************************************/ |
1378 /***********************/ |
1378 /***********************/ |
1379 /* B 3.1 - Expressions */ |
1379 /* B 3.1 - Expressions */ |
1380 /***********************/ |
1380 /***********************/ |
|
1381 /* 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! */ |
|
1382 void *narrow_candidate_datatypes_c::visit(deref_expression_c *symbol) { |
|
1383 for (unsigned int i = 0; i < symbol->exp->candidate_datatypes.size(); i++) { |
|
1384 /* Determine whether the datatype is a ref_spec_c, as this is the class used as the */ |
|
1385 /* canonical/base datatype of REF_TO types (see search_base_type_c ...) */ |
|
1386 ref_spec_c *ref_spec = dynamic_cast<ref_spec_c *>(symbol->exp->candidate_datatypes[i]); |
|
1387 |
|
1388 if ((NULL != ref_spec) && get_datatype_info_c::is_type_equal(ref_spec->type_name, symbol->datatype)) |
|
1389 /* if it points to the required datatype for symbol, then that is the required datatype for symbol->exp */ |
|
1390 symbol->exp->datatype = ref_spec; |
|
1391 } |
|
1392 |
|
1393 symbol->exp->accept(*this); |
|
1394 return NULL; |
|
1395 } |
|
1396 |
|
1397 |
1381 /* 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! */ |
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! */ |
1382 void *narrow_candidate_datatypes_c::visit( ref_expression_c *symbol) { |
1399 void *narrow_candidate_datatypes_c::visit( ref_expression_c *symbol) { |
1383 if (symbol->exp->candidate_datatypes.size() > 0) { |
1400 if (symbol->exp->candidate_datatypes.size() > 0) { |
1384 symbol->exp->datatype = symbol->exp->candidate_datatypes[0]; /* just use the first possible datatype */ |
1401 symbol->exp->datatype = symbol->exp->candidate_datatypes[0]; /* just use the first possible datatype */ |
1385 } |
1402 } |