# HG changeset patch # User Mario de Sousa # Date 1346437848 -3600 # Node ID ea78924a1f60b1361d16d4572ae0cb0df03454bb # Parent 7fe1533d22603e36f976ad4df1624fcd9c49b1d5 Deleting datatype checks no longer needed (with a view of making search_expression_type_c redundant). diff -r 7fe1533d2260 -r ea78924a1f60 stage4/generate_c/generate_c_il.cc --- a/stage4/generate_c/generate_c_il.cc Fri Aug 31 15:09:25 2012 +0100 +++ b/stage4/generate_c/generate_c_il.cc Fri Aug 31 19:30:48 2012 +0100 @@ -1878,63 +1878,12 @@ return NULL; } -void *visit(GT_operator_c *symbol) { - if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) && - search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator(this->current_operand, "GT_"); - } else { - ERROR; - } - return NULL; -} - -void *visit(GE_operator_c *symbol) { - if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) && - search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator(this->current_operand, "GE_"); - } else { - ERROR; - } - return NULL; -} - -void *visit(EQ_operator_c *symbol) { - if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator(this->current_operand, "EQ_"); - } else { - ERROR; - } - return NULL; -} - -void *visit(LT_operator_c *symbol) { - if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) && - search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator(this->current_operand, "LT_"); - } else { - ERROR; - } - return NULL; -} - -void *visit(LE_operator_c *symbol) { - if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) && - search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator(this->current_operand, "LE_"); - } else { - ERROR; - } - return NULL; -} - -void *visit(NE_operator_c *symbol) { - if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator(this->current_operand, "NE_"); - } else { - ERROR; - } - return NULL; -} +void *visit(GT_operator_c *symbol) {CMP_operator(this->current_operand, "GT_"); return NULL;} +void *visit(GE_operator_c *symbol) {CMP_operator(this->current_operand, "GE_"); return NULL;} +void *visit(EQ_operator_c *symbol) {CMP_operator(this->current_operand, "EQ_"); return NULL;} +void *visit(LT_operator_c *symbol) {CMP_operator(this->current_operand, "LT_"); return NULL;} +void *visit(LE_operator_c *symbol) {CMP_operator(this->current_operand, "LE_"); return NULL;} +void *visit(NE_operator_c *symbol) {CMP_operator(this->current_operand, "NE_"); return NULL;} //SYM_REF0(CAL_operator_c) diff -r 7fe1533d2260 -r ea78924a1f60 stage4/generate_c/generate_c_inlinefcall.cc --- a/stage4/generate_c/generate_c_inlinefcall.cc Fri Aug 31 15:09:25 2012 +0100 +++ b/stage4/generate_c/generate_c_inlinefcall.cc Fri Aug 31 19:30:48 2012 +0100 @@ -965,57 +965,12 @@ return NULL; } - void *visit(GT_operator_c *symbol) { - if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) && - search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator_result_type(); - } - else {ERROR;} - return NULL; - } - - void *visit(GE_operator_c *symbol) { - if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) && - search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator_result_type(); - } - else {ERROR;} - return NULL; - } - - void *visit(EQ_operator_c *symbol) { - if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator_result_type(); - } - else {ERROR;} - return NULL; - } - - void *visit(LT_operator_c *symbol) { - if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) && - search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator_result_type(); - } - else {ERROR;} - return NULL; - } - - void *visit(LE_operator_c *symbol) { - if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) && - search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator_result_type(); - } - else {ERROR;} - return NULL; - } - - void *visit(NE_operator_c *symbol) { - if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) { - CMP_operator_result_type(); - } - else {ERROR;} - return NULL; - } + void *visit(GT_operator_c *symbol) {CMP_operator_result_type(); return NULL;} + void *visit(GE_operator_c *symbol) {CMP_operator_result_type(); return NULL;} + void *visit(EQ_operator_c *symbol) {CMP_operator_result_type(); return NULL;} + void *visit(LT_operator_c *symbol) {CMP_operator_result_type(); return NULL;} + void *visit(LE_operator_c *symbol) {CMP_operator_result_type(); return NULL;} + void *visit(NE_operator_c *symbol) {CMP_operator_result_type(); return NULL;} /***************************************/ /* B.3 - Language ST (Structured Text) */ diff -r 7fe1533d2260 -r ea78924a1f60 stage4/generate_c/generate_c_st.cc --- a/stage4/generate_c/generate_c_st.cc Fri Aug 31 15:09:25 2012 +0100 +++ b/stage4/generate_c/generate_c_st.cc Fri Aug 31 19:30:48 2012 +0100 @@ -482,8 +482,7 @@ void *visit(equ_expression_c *symbol) { symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); - if (!search_expression_type->is_same_type(left_type, right_type)) - ERROR; + // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! if (search_expression_type->is_time_type(left_type) || search_expression_type->is_string_type(left_type)) return print_compare_function("EQ_", left_type, symbol->l_exp, symbol->r_exp); @@ -493,8 +492,7 @@ void *visit(notequ_expression_c *symbol) { symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); - if (!search_expression_type->is_same_type(left_type, right_type)) - ERROR; + // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! if (search_expression_type->is_time_type(left_type) || search_expression_type->is_string_type(left_type)) return print_compare_function("NE_", left_type, symbol->l_exp, symbol->r_exp); @@ -504,57 +502,41 @@ void *visit(lt_expression_c *symbol) { symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); - if (!search_expression_type->is_same_type(left_type, right_type)) - ERROR; + // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! if (search_expression_type->is_time_type(left_type) || search_expression_type->is_string_type(left_type)) return print_compare_function("LT_", left_type, symbol->l_exp, symbol->r_exp); - if (!search_base_type.type_is_enumerated(left_type)) - return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); - ERROR; - return NULL; + return print_binary_expression(symbol->l_exp, symbol->r_exp, " < "); } void *visit(gt_expression_c *symbol) { symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); - if (!search_expression_type->is_same_type(left_type, right_type)) - ERROR; + // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! if (search_expression_type->is_time_type(left_type) || search_expression_type->is_string_type(left_type)) return print_compare_function("GT_", left_type, symbol->l_exp, symbol->r_exp); - if (!search_base_type.type_is_enumerated(left_type)) - return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); - ERROR; - return NULL; + return print_binary_expression(symbol->l_exp, symbol->r_exp, " > "); } void *visit(le_expression_c *symbol) { symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); - if (!search_expression_type->is_same_type(left_type, right_type)) - ERROR; + // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! if (search_expression_type->is_time_type(left_type) || search_expression_type->is_string_type(left_type)) return print_compare_function("LE_", left_type, symbol->l_exp, symbol->r_exp); - if (!search_base_type.type_is_enumerated(left_type)) - return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); - ERROR; - return NULL; + return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= "); } void *visit(ge_expression_c *symbol) { symbol_c *left_type = search_expression_type->get_type(symbol->l_exp); symbol_c *right_type = search_expression_type->get_type(symbol->r_exp); - if (!search_expression_type->is_same_type(left_type, right_type)) - ERROR; + // if (!search_expression_type->is_same_type(left_type, right_type)) ERROR; // This check is no longer needed! if (search_expression_type->is_time_type(left_type) || search_expression_type->is_string_type(left_type)) return print_compare_function("GE_", left_type, symbol->l_exp, symbol->r_exp); - if (!search_base_type.type_is_enumerated(left_type)) - return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); - ERROR; - return NULL; + return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= "); } void *visit(add_expression_c *symbol) {