diff --git a/crates/nu-protocol/src/engine/mod.rs b/crates/nu-protocol/src/engine/mod.rs index e6b7eb5d3d..81228717b8 100644 --- a/crates/nu-protocol/src/engine/mod.rs +++ b/crates/nu-protocol/src/engine/mod.rs @@ -1,9 +1,9 @@ mod call_info; mod command; mod engine_state; -mod evaluation_context; +mod stack; pub use call_info::*; pub use command::*; pub use engine_state::*; -pub use evaluation_context::*; +pub use stack::*; diff --git a/crates/nu-protocol/src/engine/evaluation_context.rs b/crates/nu-protocol/src/engine/stack.rs similarity index 69% rename from crates/nu-protocol/src/engine/evaluation_context.rs rename to crates/nu-protocol/src/engine/stack.rs index a67318bd51..b08000a578 100644 --- a/crates/nu-protocol/src/engine/evaluation_context.rs +++ b/crates/nu-protocol/src/engine/stack.rs @@ -1,46 +1,6 @@ -use super::EngineState; use std::collections::HashMap; -use crate::{Example, ShellError, Signature, Value, VarId}; - -#[derive(Clone)] -pub struct EvaluationContext { - pub engine_state: Box, - pub stack: Stack, -} - -impl EvaluationContext { - pub fn get_var(&self, var_id: VarId) -> Result { - self.stack.get_var(var_id) - } - - pub fn enter_scope(&self) -> EvaluationContext { - Self { - engine_state: self.engine_state.clone(), - stack: self.stack.clone().enter_scope(), - } - } - - pub fn add_var(&mut self, var_id: VarId, value: Value) { - self.stack.add_var(var_id, value); - } - - pub fn add_env_var(&mut self, var: String, value: String) { - self.stack.add_env_var(var, value); - } - - pub fn print_stack(&self) { - self.stack.print_stack(); - } - - pub fn get_signatures(&self) -> Vec { - self.engine_state.get_signatures() - } - - pub fn get_signatures_with_examples(&self) -> Vec<(Signature, Vec)> { - self.engine_state.get_signatures_with_examples() - } -} +use crate::{ShellError, Value, VarId}; #[derive(Debug, Clone)] pub struct StackFrame {