mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-02 20:25:34 +08:00
Equip parser_t with a variable stack
Prepares to eliminate env_get and env_set by accessing variables through a parser.
This commit is contained in:
parent
bba66a3ecc
commit
a47f6859bd
|
@ -100,7 +100,7 @@ static wcstring user_presentable_path(const wcstring &path) {
|
|||
return replace_home_directory_with_tilde(path);
|
||||
}
|
||||
|
||||
parser_t::parser_t() = default;
|
||||
parser_t::parser_t() : variables(env_stack_t::principal()) {}
|
||||
|
||||
// Out of line destructor to enable forward declaration of parse_execution_context_t
|
||||
parser_t::~parser_t() = default;
|
||||
|
|
|
@ -173,7 +173,8 @@ class parser_t {
|
|||
std::vector<std::unique_ptr<block_t>> block_stack;
|
||||
/// The 'depth' of the fish call stack.
|
||||
int eval_level = -1;
|
||||
|
||||
/// Set of variables for the parser.
|
||||
env_stack_t &variables;
|
||||
#if 0
|
||||
// TODO: Lint says this isn't used (which is true). Should this be removed?
|
||||
/// Gets a description of the block stack, for debugging.
|
||||
|
@ -271,6 +272,10 @@ class parser_t {
|
|||
/// Get the list of jobs.
|
||||
job_list_t &job_list() { return my_job_list; }
|
||||
|
||||
/// Get the variables.
|
||||
env_stack_t &vars() { return variables; }
|
||||
const env_stack_t &vars() const { return variables; }
|
||||
|
||||
/// Pushes a new block created with the given arguments
|
||||
/// Returns a pointer to the block. The pointer is valid
|
||||
/// until the call to pop_block()
|
||||
|
|
Loading…
Reference in New Issue
Block a user