mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 15:16:40 +08:00
parsed_source_t to hold an ast directly instead of through unique_ptr
We have untangled the dependency loop and so now parsed_source_t no longer requires indirection.
This commit is contained in:
parent
5308223212
commit
71a8eb0aa4
|
@ -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.
|
||||
|
|
|
@ -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<ast::ast_t>(std::move(ast))) {}
|
||||
: src(std::move(s)), ast(std::move(ast)) {}
|
||||
|
||||
parsed_source_t::~parsed_source_t() = default;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#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_t> ast;
|
||||
ast::ast_t ast;
|
||||
|
||||
parsed_source_t(wcstring s, ast::ast_t &&ast);
|
||||
~parsed_source_t();
|
||||
|
|
|
@ -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<ast::job_list_t>();
|
||||
const auto *job_list = ps->ast.top()->as<ast::job_list_t>();
|
||||
if (!job_list->empty()) {
|
||||
// Execute the top job list.
|
||||
return this->eval_node(ps, *job_list, io, job_group, block_type);
|
||||
|
|
Loading…
Reference in New Issue
Block a user