forked from extern/nushell
return const values from scope variables
(#14577)
Fixes #14542 # User-Facing Changes Constant values are no longer missing from `scope variables` output when the IR evaluator is enabled: ```diff const foo = 1 scope variables | where name == "$foo" | get value.0 | to nuon -null +int ```
This commit is contained in:
@ -56,11 +56,12 @@ impl<'e, 's> ScopeData<'e, 's> {
|
||||
let var_type = Value::string(var.ty.to_string(), span);
|
||||
let is_const = Value::bool(var.const_val.is_some(), span);
|
||||
|
||||
let var_value = if let Ok(val) = self.stack.get_var(**var_id, span) {
|
||||
val
|
||||
} else {
|
||||
Value::nothing(span)
|
||||
};
|
||||
let var_value = self
|
||||
.stack
|
||||
.get_var(**var_id, span)
|
||||
.ok()
|
||||
.or(var.const_val.clone())
|
||||
.unwrap_or(Value::nothing(span));
|
||||
|
||||
let var_id_val = Value::int(var_id.get() as i64, span);
|
||||
|
||||
|
Reference in New Issue
Block a user