Update todo

This commit is contained in:
JT
2021-08-27 14:30:10 +12:00
parent bb9e6731ea
commit 24cd1b591c
3 changed files with 20 additions and 6 deletions

View File

@ -34,11 +34,12 @@ fn eval_call(state: &State, call: &Call) -> Result<Value, ShellError> {
let decl = parser_state.get_decl(call.decl_id);
if let Some(block_id) = decl.body {
let state = state.enter_scope();
for (arg, param) in call
.positional
.iter()
.zip(decl.signature.required_positional.iter())
{
for (arg, param) in call.positional.iter().zip(
decl.signature
.required_positional
.iter()
.chain(decl.signature.optional_positional.iter()),
) {
let result = eval_expression(&state, arg)?;
let var_id = param
.var_id

View File

@ -89,7 +89,16 @@ impl Display for Value {
write!(f, "{}", val)
}
Value::String { val, .. } => write!(f, "{}", val),
Value::List { .. } => write!(f, "<list>"),
Value::List { val, .. } => {
write!(
f,
"[{}]",
val.iter()
.map(|x| x.to_string())
.collect::<Vec<String>>()
.join(", ".into())
)
}
Value::Block { .. } => write!(f, "<block>"),
Value::Nothing { .. } => write!(f, ""),
}