diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index a29460df7..8fbd1b89d 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -576,10 +576,7 @@ parse_execution_result_t parse_execution_context_t::run_switch_statement( } parse_execution_result_t parse_execution_context_t::run_while_statement( - const parse_node_t &header, const parse_node_t &block_contents) { - assert(header.type == symbol_while_header); - assert(block_contents.type == symbol_job_list); - + tnode_t header, tnode_t contents) { // Push a while block. while_block_t *wb = parser->push_block(); wb->node_offset = this->get_offset(header); @@ -587,8 +584,8 @@ parse_execution_result_t parse_execution_context_t::run_while_statement( parse_execution_result_t ret = parse_execution_success; // The conditions of the while loop. - const parse_node_t &condition_head = *get_child(header, 1, symbol_job); - const parse_node_t &condition_boolean_tail = *get_child(header, 3, symbol_andor_job_list); + tnode_t condition_head = header.child<1>(); + tnode_t condition_boolean_tail = header.child<3>(); // Run while the condition is true. for (;;) { @@ -610,7 +607,7 @@ parse_execution_result_t parse_execution_context_t::run_while_statement( } // The block ought to go inside the loop (see issue #1212). - this->run_job_list(block_contents, wb); + this->run_job_list(contents, wb); if (this->cancellation_reason(wb) == execution_cancellation_loop_control) { // Handle break or continue. diff --git a/src/parse_execution.h b/src/parse_execution.h index 9b971df44..929b19a15 100644 --- a/src/parse_execution.h +++ b/src/parse_execution.h @@ -99,8 +99,8 @@ class parse_execution_context_t { tnode_t contents); parse_execution_result_t run_if_statement(tnode_t statement); parse_execution_result_t run_switch_statement(tnode_t statement); - parse_execution_result_t run_while_statement(const parse_node_t &header, - const parse_node_t &contents); + parse_execution_result_t run_while_statement(tnode_t statement, + tnode_t contents); parse_execution_result_t run_function_statement(const parse_node_t &header, const parse_node_t &block_end_command); parse_execution_result_t run_begin_statement(const parse_node_t &header,