1018 /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */ |
1018 /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */ |
1019 // SYM_REF3(il_expression_c, il_expr_operator, il_operand, simple_instr_list); |
1019 // SYM_REF3(il_expression_c, il_expr_operator, il_operand, simple_instr_list); |
1020 void *fill_candidate_datatypes_c::visit(il_expression_c *symbol) { |
1020 void *fill_candidate_datatypes_c::visit(il_expression_c *symbol) { |
1021 symbol_c *prev_il_instruction_backup = prev_il_instruction; |
1021 symbol_c *prev_il_instruction_backup = prev_il_instruction; |
1022 |
1022 |
1023 if (NULL != symbol->il_operand) |
1023 /* Stage2 will insert an artificial (and equivalent) LD <il_operand> to the simple_instr_list if necessary. We can therefore ignore the 'il_operand' entry! */ |
1024 symbol->il_operand->accept(*this); |
1024 // if (NULL != symbol->il_operand) |
|
1025 // symbol->il_operand->accept(*this); |
1025 |
1026 |
1026 if(symbol->simple_instr_list != NULL) |
1027 if(symbol->simple_instr_list != NULL) |
1027 symbol->simple_instr_list->accept(*this); |
1028 symbol->simple_instr_list->accept(*this); |
1028 |
1029 |
|
1030 /* Since stage2 will insert an artificial (and equivalent) LD <il_operand> to the simple_instr_list when an 'il_operand' exists, we know |
|
1031 * that if (symbol->il_operand != NULL), then the first IL instruction in the simple_instr_list will be the equivalent and artificial |
|
1032 * 'LD <il_operand>' IL instruction. |
|
1033 * Just to be cosistent, we will copy the datatype info back into the il_operand, even though this should not be necessary! |
|
1034 */ |
|
1035 if ((NULL != symbol->il_operand) && ((NULL == symbol->simple_instr_list) || (0 == ((list_c *)symbol->simple_instr_list)->n))) ERROR; // stage2 is not behaving as we expect it to! |
|
1036 if (NULL != symbol->il_operand) |
|
1037 symbol->il_operand->candidate_datatypes = ((list_c *)symbol->simple_instr_list)->elements[0]->candidate_datatypes; |
|
1038 |
1029 /* Now check the if the data type semantics of operation are correct, */ |
1039 /* Now check the if the data type semantics of operation are correct, */ |
1030 il_operand = symbol->simple_instr_list; |
1040 il_operand = symbol->simple_instr_list; |
1031 prev_il_instruction = prev_il_instruction_backup; |
1041 prev_il_instruction = prev_il_instruction_backup; |
1032 symbol->il_expr_operator->accept(*this); |
1042 symbol->il_expr_operator->accept(*this); |
1033 il_operand = NULL; |
1043 il_operand = NULL; |