mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Rename ast::job_t to ast::job_pipeline_t
This works around an autocxx limitations where different types cannot have the same name even if they live in different namespace. ast::job_t conflicts with job_t.
This commit is contained in:
parent
e674678ea4
commit
f38543ccb7
6 changed files with 21 additions and 21 deletions
|
@ -497,7 +497,7 @@ struct statement_t final : public branch_t<type_t::statement> {
|
|||
|
||||
// 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<type_t::job> {
|
||||
struct job_pipeline_t final : public branch_t<type_t::job_pipeline> {
|
||||
// Maybe the time keyword.
|
||||
optional_t<keyword_t<parse_keyword_t::kw_time>> time;
|
||||
|
||||
|
@ -523,7 +523,7 @@ struct job_conjunction_t final : public branch_t<type_t::job_conjunction> {
|
|||
optional_t<decorator_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)
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<job_t>()) {
|
||||
if (auto job = p->try_as<job_pipeline_t>()) {
|
||||
if (!job->variables.empty()) result |= allow_escaped_newlines;
|
||||
} else if (auto job_cnt = p->try_as<job_continuation_t>()) {
|
||||
if (!job_cnt->variables.empty()) result |= allow_escaped_newlines;
|
||||
|
|
|
@ -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<end_execution_reason_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<int> saved_eval_level(&parser->eval_level, parser->eval_level + 1);
|
||||
|
||||
// Save the node index.
|
||||
scoped_push<const ast::job_t *> saved_node(&executing_job_node, &job_node);
|
||||
scoped_push<const ast::job_pipeline_t *> 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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<statement_t>();
|
||||
|
||||
// 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<ast::job_t>();
|
||||
job = cursor->try_as<ast::job_pipeline_t>();
|
||||
}
|
||||
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<argument_t>()) {
|
||||
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<ast::job_t>()) {
|
||||
} else if (const ast::job_pipeline_t *job = node.try_as<ast::job_pipeline_t>()) {
|
||||
// Disallow background in the following cases:
|
||||
//
|
||||
// foo & ; and bar
|
||||
|
|
Loading…
Reference in a new issue