Make $nu constant (#10160)

This commit is contained in:
Jakub Žádník
2023-09-01 09:18:55 +03:00
committed by GitHub
parent 7d6b23ee2f
commit f35808cb89
13 changed files with 284 additions and 218 deletions

View File

@ -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