mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 11:45:50 +02:00
Change type of parameter default values to Option<Value>
(#8940)
# Description
Fixes #8939.
# User-Facing Changes
- Parameter default values will now be parsed as constants.
- If the default value is not a constant, a parser error is displayed.
# Tests + Formatting
The [only affected
test](d42c2b2dbc/src/tests/test_engine.rs (L325-L328)
)
has been updated to reflect the new behavior.
This commit is contained in:
committed by
GitHub
parent
77ca73f414
commit
e251f3a0b4
@ -72,9 +72,8 @@ pub fn eval_call(
|
||||
if let Some(arg) = call.positional_nth(param_idx) {
|
||||
let result = eval_expression(engine_state, caller_stack, arg)?;
|
||||
callee_stack.add_var(var_id, result);
|
||||
} else if let Some(arg) = ¶m.default_value {
|
||||
let result = eval_expression(engine_state, caller_stack, arg)?;
|
||||
callee_stack.add_var(var_id, result);
|
||||
} else if let Some(value) = ¶m.default_value {
|
||||
callee_stack.add_var(var_id, value.to_owned());
|
||||
} else {
|
||||
callee_stack.add_var(var_id, Value::nothing(call.head));
|
||||
}
|
||||
|
Reference in New Issue
Block a user