mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 13:23:09 +00:00
Adopt tnode_t in run_function_statement
This commit is contained in:
parent
edc3d92eda
commit
6f99c9a904
2 changed files with 7 additions and 9 deletions
|
@ -343,10 +343,7 @@ parse_execution_result_t parse_execution_context_t::run_begin_statement(
|
||||||
|
|
||||||
// Define a function.
|
// Define a function.
|
||||||
parse_execution_result_t parse_execution_context_t::run_function_statement(
|
parse_execution_result_t parse_execution_context_t::run_function_statement(
|
||||||
const parse_node_t &header, const parse_node_t &block_end_command) {
|
tnode_t<g::function_header> header, tnode_t<g::end_command> block_end_command) {
|
||||||
assert(header.type == symbol_function_header);
|
|
||||||
assert(block_end_command.type == symbol_end_command);
|
|
||||||
|
|
||||||
// Get arguments.
|
// Get arguments.
|
||||||
wcstring_list_t argument_list;
|
wcstring_list_t argument_list;
|
||||||
parse_execution_result_t result = this->determine_arguments(header, &argument_list, failglob);
|
parse_execution_result_t result = this->determine_arguments(header, &argument_list, failglob);
|
||||||
|
@ -358,9 +355,10 @@ parse_execution_result_t parse_execution_context_t::run_function_statement(
|
||||||
// The function definition extends from the end of the header to the function end. It's not
|
// The function definition extends from the end of the header to the function end. It's not
|
||||||
// just the range of the contents because that loses comments - see issue #1710.
|
// just the range of the contents because that loses comments - see issue #1710.
|
||||||
assert(block_end_command.has_source());
|
assert(block_end_command.has_source());
|
||||||
size_t contents_start = header.source_start + header.source_length;
|
auto header_range = header.source_range();
|
||||||
size_t contents_end =
|
size_t contents_start = header_range->start + header_range->length;
|
||||||
block_end_command.source_start; // 1 past the last character in the function definition
|
size_t contents_end = block_end_command.source_range()
|
||||||
|
->start; // 1 past the last character in the function definition
|
||||||
assert(contents_end >= contents_start);
|
assert(contents_end >= contents_start);
|
||||||
|
|
||||||
// Swallow whitespace at both ends.
|
// Swallow whitespace at both ends.
|
||||||
|
|
|
@ -101,8 +101,8 @@ class parse_execution_context_t {
|
||||||
parse_execution_result_t run_switch_statement(tnode_t<grammar::switch_statement> statement);
|
parse_execution_result_t run_switch_statement(tnode_t<grammar::switch_statement> statement);
|
||||||
parse_execution_result_t run_while_statement(tnode_t<grammar::while_header> statement,
|
parse_execution_result_t run_while_statement(tnode_t<grammar::while_header> statement,
|
||||||
tnode_t<grammar::job_list> contents);
|
tnode_t<grammar::job_list> contents);
|
||||||
parse_execution_result_t run_function_statement(const parse_node_t &header,
|
parse_execution_result_t run_function_statement(tnode_t<grammar::function_header> header,
|
||||||
const parse_node_t &block_end_command);
|
tnode_t<grammar::end_command> block_end);
|
||||||
parse_execution_result_t run_begin_statement(const parse_node_t &header,
|
parse_execution_result_t run_begin_statement(const parse_node_t &header,
|
||||||
const parse_node_t &contents);
|
const parse_node_t &contents);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue