diff --git a/src/ast.h b/src/ast.h index ed7081e72..86ea1b853 100644 --- a/src/ast.h +++ b/src/ast.h @@ -497,7 +497,7 @@ struct statement_t final : public branch_t { // A job is a non-empty list of statements, separated by pipes. (Non-empty is useful for cases // like if statements, where we require a command). -struct job_t final : public branch_t { +struct job_pipeline_t final : public branch_t { // Maybe the time keyword. optional_t> time; @@ -523,7 +523,7 @@ struct job_conjunction_t final : public branch_t { optional_t decorator{}; // The job itself. - job_t job; + job_pipeline_t job; // The rest of the job conjunction, with && or ||s. job_conjunction_continuation_list_t continuations; @@ -727,7 +727,7 @@ struct job_conjunction_continuation_t final maybe_newlines_t newlines; // The job itself. - job_t job; + job_pipeline_t job; FIELDS(conjunction, newlines, job) }; diff --git a/src/ast_node_types.inc b/src/ast_node_types.inc index b0ac3ea98..1a18675e2 100644 --- a/src/ast_node_types.inc +++ b/src/ast_node_types.inc @@ -19,7 +19,7 @@ ELEMLIST(argument_or_redirection_list, argument_or_redirection) ELEM(variable_assignment) ELEMLIST(variable_assignment_list, variable_assignment) -ELEM(job) +ELEM(job_pipeline) ELEM(job_conjunction) // For historical reasons, a job list is a list of job *conjunctions*. This should be fixed. ELEMLIST(job_list, job_conjunction) diff --git a/src/fish_indent.cpp b/src/fish_indent.cpp index 142786608..b4220182c 100644 --- a/src/fish_indent.cpp +++ b/src/fish_indent.cpp @@ -194,7 +194,7 @@ struct pretty_printer_t { p = p->parent; assert(p->type == type_t::statement); p = p->parent; - if (auto job = p->try_as()) { + if (auto job = p->try_as()) { if (!job->variables.empty()) result |= allow_escaped_newlines; } else if (auto job_cnt = p->try_as()) { if (!job_cnt->variables.empty()) result |= allow_escaped_newlines; diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index 105009511..e3a6e015c 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -150,7 +150,7 @@ parse_execution_context_t::infinite_recursive_statement_in_job_list(const ast::j // Get the first job in the job list. const ast::job_conjunction_t *jc = jobs.at(0); if (!jc) return nullptr; - const ast::job_t *job = &jc->job; + const ast::job_pipeline_t *job = &jc->job; // Helper to return if a statement is infinitely recursive in this function. auto statement_recurses = @@ -245,7 +245,7 @@ maybe_t parse_execution_context_t::check_end_execution() } /// Return whether the job contains a single statement, of block type, with no redirections. -bool parse_execution_context_t::job_is_simple_block(const ast::job_t &job) const { +bool parse_execution_context_t::job_is_simple_block(const ast::job_pipeline_t &job) const { using namespace ast; // Must be no pipes. if (!job.continuation.empty()) { @@ -1180,7 +1180,7 @@ end_execution_reason_t parse_execution_context_t::populate_job_process( } end_execution_reason_t parse_execution_context_t::populate_job_from_job_node( - job_t *j, const ast::job_t &job_node, const block_t *associated_block) { + job_t *j, const ast::job_pipeline_t &job_node, const block_t *associated_block) { UNUSED(associated_block); // We are going to construct process_t structures for every statement in the job. @@ -1244,7 +1244,7 @@ static bool remove_job(parser_t &parser, const job_t *job) { /// For historical reasons the 'not' and 'time' prefix are "inside out". That is, it's /// 'not time cmd'. Note that a time appearing anywhere in the pipeline affects the whole job. /// `sleep 1 | not time true` will time the whole job! -static bool job_node_wants_timing(const ast::job_t &job_node) { +static bool job_node_wants_timing(const ast::job_pipeline_t &job_node) { // Does our job have the job-level time prefix? if (job_node.time) return true; @@ -1266,7 +1266,7 @@ static bool job_node_wants_timing(const ast::job_t &job_node) { return false; } -end_execution_reason_t parse_execution_context_t::run_1_job(const ast::job_t &job_node, +end_execution_reason_t parse_execution_context_t::run_1_job(const ast::job_pipeline_t &job_node, const block_t *associated_block) { if (auto ret = check_end_execution()) { return *ret; @@ -1288,7 +1288,7 @@ end_execution_reason_t parse_execution_context_t::run_1_job(const ast::job_t &jo scoped_push saved_eval_level(&parser->eval_level, parser->eval_level + 1); // Save the node index. - scoped_push saved_node(&executing_job_node, &job_node); + scoped_push saved_node(&executing_job_node, &job_node); // Profiling support. profile_item_t *profile_item = this->parser->create_profile_item(); @@ -1577,7 +1577,7 @@ bool parse_execution_context_t::use_job_control() const { DIE("Unreachable"); } -int parse_execution_context_t::line_offset_of_node(const ast::job_t *node) { +int parse_execution_context_t::line_offset_of_node(const ast::job_pipeline_t *node) { // If we're not executing anything, return -1. if (!node) { return -1; diff --git a/src/parse_execution.h b/src/parse_execution.h index 8b1d78aba..34553c8f5 100644 --- a/src/parse_execution.h +++ b/src/parse_execution.h @@ -47,7 +47,7 @@ class parse_execution_context_t : noncopyable_t { int cancel_signal{0}; // The currently executing job node, used to indicate the line number. - const ast::job_t *executing_job_node{}; + const ast::job_pipeline_t *executing_job_node{}; // Cached line number information. size_t cached_lineno_offset = 0; @@ -84,7 +84,7 @@ class parse_execution_context_t : noncopyable_t { wcstring *out_cmd, wcstring_list_t *out_args) const; /// Indicates whether a job is a simple block (one block, no redirections). - bool job_is_simple_block(const ast::job_t &job) const; + bool job_is_simple_block(const ast::job_pipeline_t &job) const; enum process_type_t process_type_for_command(const ast::decorated_statement_t &statement, const wcstring &cmd) const; @@ -135,7 +135,7 @@ class parse_execution_context_t : noncopyable_t { end_execution_reason_t determine_redirections(const ast::argument_or_redirection_list_t &list, redirection_spec_list_t *out_redirections); - end_execution_reason_t run_1_job(const ast::job_t &job, const block_t *associated_block); + end_execution_reason_t run_1_job(const ast::job_pipeline_t &job, const block_t *associated_block); end_execution_reason_t test_and_run_1_job_conjunction(const ast::job_conjunction_t &jc, const block_t *associated_block); end_execution_reason_t run_job_conjunction(const ast::job_conjunction_t &job_expr, @@ -144,7 +144,7 @@ class parse_execution_context_t : noncopyable_t { const block_t *associated_block); end_execution_reason_t run_job_list(const ast::andor_job_list_t &job_list_node, const block_t *associated_block); - end_execution_reason_t populate_job_from_job_node(job_t *j, const ast::job_t &job_node, + end_execution_reason_t populate_job_from_job_node(job_t *j, const ast::job_pipeline_t &job_node, const block_t *associated_block); // Assign a job group to the given job. @@ -154,7 +154,7 @@ class parse_execution_context_t : noncopyable_t { bool use_job_control() const; // Returns the line number of the node. Not const since it touches cached_lineno_offset. - int line_offset_of_node(const ast::job_t *node); + int line_offset_of_node(const ast::job_pipeline_t *node); int line_offset_of_character_at_offset(size_t offset); public: diff --git a/src/parse_util.cpp b/src/parse_util.cpp index dc09d3071..125a939da 100644 --- a/src/parse_util.cpp +++ b/src/parse_util.cpp @@ -1058,7 +1058,7 @@ parser_test_error_bits_t parse_util_detect_errors_in_argument(const ast::argumen } /// Given that the job given by node should be backgrounded, return true if we detect any errors. -static bool detect_errors_in_backgrounded_job(const ast::job_t &job, +static bool detect_errors_in_backgrounded_job(const ast::job_pipeline_t &job, parse_error_list_t *parse_errors) { using namespace ast; auto source_range = job.try_source_range(); @@ -1127,10 +1127,10 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src, const statement_t *st = dst.parent->as(); // Walk up to the job. - const ast::job_t *job = nullptr; + const ast::job_pipeline_t *job = nullptr; for (const node_t *cursor = st; job == nullptr; cursor = cursor->parent) { assert(cursor && "Reached root without finding a job"); - job = cursor->try_as(); + job = cursor->try_as(); } assert(job && "Should have found the job"); @@ -1304,7 +1304,7 @@ parser_test_error_bits_t parse_util_detect_errors(const ast::ast_t &ast, const w } else if (const argument_t *arg = node.try_as()) { const wcstring &arg_src = arg->source(buff_src, &storage); res |= parse_util_detect_errors_in_argument(*arg, arg_src, out_errors); - } else if (const ast::job_t *job = node.try_as()) { + } else if (const ast::job_pipeline_t *job = node.try_as()) { // Disallow background in the following cases: // // foo & ; and bar