diff --git a/src/parse_execution.h b/src/parse_execution.h index 0775fcb96..acb32fa28 100644 --- a/src/parse_execution.h +++ b/src/parse_execution.h @@ -164,7 +164,7 @@ class parse_execution_context_t { const wcstring &get_source() const { return pstree->src; } /// Return the parsed ast. - const ast::ast_t &ast() const { return *pstree->ast; } + const ast::ast_t &ast() const { return pstree->ast; } /// Start executing at the given node. Returns 0 if there was no error, 1 if there was an /// error. diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index b0a4f4541..b480248e2 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -203,7 +203,7 @@ wcstring parse_token_t::user_presentable_description() const { } parsed_source_t::parsed_source_t(wcstring s, ast::ast_t &&ast) - : src(std::move(s)), ast(make_unique(std::move(ast))) {} + : src(std::move(s)), ast(std::move(ast)) {} parsed_source_t::~parsed_source_t() = default; diff --git a/src/parse_tree.h b/src/parse_tree.h index 22046dd43..84c480acc 100644 --- a/src/parse_tree.h +++ b/src/parse_tree.h @@ -10,6 +10,7 @@ #include #include +#include "ast.h" #include "common.h" #include "maybe.h" #include "parse_constants.h" @@ -62,7 +63,7 @@ class ast_t; /// A type wrapping up a parse tree and the original source behind it. struct parsed_source_t { wcstring src; - std::unique_ptr ast; + ast::ast_t ast; parsed_source_t(wcstring s, ast::ast_t &&ast); ~parsed_source_t(); diff --git a/src/parser.cpp b/src/parser.cpp index caa627680..ceca6172e 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -655,7 +655,7 @@ eval_res_t parser_t::eval(const wcstring &cmd, const io_chain_t &io, eval_res_t parser_t::eval(const parsed_source_ref_t &ps, const io_chain_t &io, const job_group_ref_t &job_group, enum block_type_t block_type) { assert(block_type == block_type_t::top || block_type == block_type_t::subst); - const auto *job_list = ps->ast->top()->as(); + const auto *job_list = ps->ast.top()->as(); if (!job_list->empty()) { // Execute the top job list. return this->eval_node(ps, *job_list, io, job_group, block_type);