Accept idents as KW args (#6644)

Support kw arg/local variable shorthand

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-15 07:42:48 +12:00
committed by GitHub
parent b23fc9f623
commit ce566fb6e5
9 changed files with 232 additions and 191 deletions

View File

@ -48,7 +48,7 @@ async fn call_map_closure(
ctxt: &ExecutorContext,
) -> Result<KclValue, KclError> {
let kw_args = KwArgs {
unlabeled: Some(Arg::new(input, source_range)),
unlabeled: Some((None, Arg::new(input, source_range))),
labeled: Default::default(),
errors: Vec::new(),
};
@ -104,7 +104,7 @@ async fn call_reduce_closure(
let mut labeled = IndexMap::with_capacity(1);
labeled.insert("accum".to_string(), Arg::new(accum, source_range));
let kw_args = KwArgs {
unlabeled: Some(Arg::new(elem, source_range)),
unlabeled: Some((None, Arg::new(elem, source_range))),
labeled,
errors: Vec::new(),
};