mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 15:58:37 +02:00
Make $nu constant (#10160)
This commit is contained in:
@ -748,6 +748,15 @@ impl EngineState {
|
||||
.expect("internal error: missing variable")
|
||||
}
|
||||
|
||||
pub fn get_constant(&self, var_id: VarId) -> Option<&Value> {
|
||||
let var = self.get_var(var_id);
|
||||
var.const_val.as_ref()
|
||||
}
|
||||
|
||||
pub fn set_variable_const_val(&mut self, var_id: VarId, val: Value) {
|
||||
self.vars[var_id].const_val = Some(val);
|
||||
}
|
||||
|
||||
#[allow(clippy::borrowed_box)]
|
||||
pub fn get_decl(&self, decl_id: DeclId) -> &Box<dyn Command> {
|
||||
self.decls
|
||||
|
Reference in New Issue
Block a user