equal
deleted
inserted
replaced
1380 /***********************/ |
1380 /***********************/ |
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! */ |
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! */ |
1382 void *narrow_candidate_datatypes_c::visit( ref_expression_c *symbol) { |
1382 void *narrow_candidate_datatypes_c::visit( ref_expression_c *symbol) { |
1383 if (symbol->exp->candidate_datatypes.size() > 0) { |
1383 if (symbol->exp->candidate_datatypes.size() > 0) { |
1384 symbol->exp->datatype = symbol->exp->candidate_datatypes[0]; /* just use the first possible datatype */ |
1384 symbol->exp->datatype = symbol->exp->candidate_datatypes[0]; /* just use the first possible datatype */ |
1385 symbol->exp->accept(*this); |
|
1386 } |
1385 } |
|
1386 symbol->exp->accept(*this); |
1387 return NULL; |
1387 return NULL; |
1388 } |
1388 } |
1389 |
1389 |
1390 |
1390 |
1391 |
1391 |
1496 /*********************************/ |
1496 /*********************************/ |
1497 /* B 3.2.1 Assignment Statements */ |
1497 /* B 3.2.1 Assignment Statements */ |
1498 /*********************************/ |
1498 /*********************************/ |
1499 |
1499 |
1500 void *narrow_candidate_datatypes_c::visit(assignment_statement_c *symbol) { |
1500 void *narrow_candidate_datatypes_c::visit(assignment_statement_c *symbol) { |
1501 if (symbol->candidate_datatypes.size() != 1) |
1501 if (symbol->candidate_datatypes.size() == 1) { |
1502 return NULL; |
1502 symbol->datatype = symbol->candidate_datatypes[0]; |
1503 symbol->datatype = symbol->candidate_datatypes[0]; |
1503 symbol->l_exp->datatype = symbol->datatype; |
1504 symbol->l_exp->datatype = symbol->datatype; |
1504 symbol->r_exp->datatype = symbol->datatype; |
|
1505 } |
|
1506 /* give the chance of any expressions inside array subscripts to be narrowed correctly */ |
1505 symbol->l_exp->accept(*this); |
1507 symbol->l_exp->accept(*this); |
1506 symbol->r_exp->datatype = symbol->datatype; |
|
1507 symbol->r_exp->accept(*this); |
1508 symbol->r_exp->accept(*this); |
1508 return NULL; |
1509 return NULL; |
1509 } |
1510 } |
1510 |
1511 |
1511 |
1512 |