1
0
forked from M-Labs/nac3

nac3core: fixed keyword arguments handling

This commit is contained in:
pca006132 2022-02-26 16:34:01 +08:00
parent 0686e83f4c
commit 846d1726ef
2 changed files with 4 additions and 1 deletions

View File

@ -526,6 +526,9 @@ pub fn gen_call<'ctx, 'a, G: CodeGenerator>(
}
// default value handling
for k in keys.into_iter() {
if mapping.get(&k.name).is_some() {
continue;
}
mapping.insert(
k.name,
ctx.gen_symbol_val(generator, &k.default_value.unwrap()).into(),

View File

@ -809,7 +809,7 @@ impl<'a> Inferencer<'a> {
posargs: args.iter().map(|v| v.custom.unwrap()).collect(),
kwargs: keywords
.iter()
.map(|v| (*v.node.arg.as_ref().unwrap(), v.custom.unwrap()))
.map(|v| (*v.node.arg.as_ref().unwrap(), v.node.value.custom.unwrap()))
.collect(),
fun: RefCell::new(None),
ret: sign.ret,