missing break ruined nested statements due to cascading effect of switch

cases.
master V0.9.6
xerox 5 years ago
parent 943c1c4d80
commit 56c4e0b589

File diff suppressed because it is too large Load Diff

@ -63,6 +63,7 @@ static node_info* create_compound_statement(node_info* new_statement_list, node_
statement_head->operation = EXEC_STMT_LIST_OPERATION; statement_head->operation = EXEC_STMT_LIST_OPERATION;
statement_head->statement_list->operation = EXEC_STMT_LIST_OPERATION; statement_head->statement_list->operation = EXEC_STMT_LIST_OPERATION;
statement_head->statement_list->next = new_statement_list; statement_head->statement_list->next = new_statement_list;
statement_head->next = NULL; statement_head->next = NULL;
statement_head->statement_list->statement_list = NULL; statement_head->statement_list->statement_list = NULL;
} }
@ -76,8 +77,8 @@ static node_info* create_compound_statement(node_info* new_statement_list, node_
p_temp_head->statement_list = malloc(sizeof(node_info)); p_temp_head->statement_list = malloc(sizeof(node_info));
p_temp_head->operation = EXEC_STMT_LIST_OPERATION; p_temp_head->operation = EXEC_STMT_LIST_OPERATION;
p_temp_head->statement_list->operation = EXEC_STMT_LIST_OPERATION; p_temp_head->statement_list->operation = EXEC_STMT_LIST_OPERATION;
p_temp_head->statement_list->next = new_statement_list; p_temp_head->statement_list->next = new_statement_list;
statement_head->next = NULL;
p_temp_head->statement_list->statement_list = NULL; p_temp_head->statement_list->statement_list = NULL;
} }
return statement_head; return statement_head;
@ -95,7 +96,6 @@ static node_info* add_to_compound_statement(node_info* new_statement, node_info*
return NULL; return NULL;
node_info* p_head_tmp = statement_head; node_info* p_head_tmp = statement_head;
while (p_head_tmp->statement_list) while (p_head_tmp->statement_list)
p_head_tmp = p_head_tmp->statement_list; p_head_tmp = p_head_tmp->statement_list;

@ -70,11 +70,12 @@ static void exec_stmt(node_info *exec_node)
default: default:
break; break;
} }
break;
} }
// execute statement list. // execute statement list.
case EXEC_STMT_LIST_OPERATION: case EXEC_STMT_LIST_OPERATION:
{ {
if(exec_node->statement_list) if (exec_node->statement_list)
exec_node = exec_node->statement_list; exec_node = exec_node->statement_list;
while (exec_node->next) while (exec_node->next)

Loading…
Cancel
Save