forked from M-Labs/nac3
core/codegen: Propagate vararg info to ConcreteFuncArg
This commit is contained in:
parent
967ef0e7dd
commit
e57133e96f
|
@ -25,6 +25,7 @@ pub struct ConcreteFuncArg {
|
||||||
pub name: StrRef,
|
pub name: StrRef,
|
||||||
pub ty: ConcreteType,
|
pub ty: ConcreteType,
|
||||||
pub default_value: Option<SymbolValue>,
|
pub default_value: Option<SymbolValue>,
|
||||||
|
pub is_vararg: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -112,6 +113,7 @@ impl ConcreteTypeStore {
|
||||||
self.from_unifier_type(unifier, primitives, arg.ty, cache)
|
self.from_unifier_type(unifier, primitives, arg.ty, cache)
|
||||||
},
|
},
|
||||||
default_value: arg.default_value.clone(),
|
default_value: arg.default_value.clone(),
|
||||||
|
is_vararg: arg.is_vararg,
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
ret: self.from_unifier_type(unifier, primitives, signature.ret, cache),
|
ret: self.from_unifier_type(unifier, primitives, signature.ret, cache),
|
||||||
|
|
|
@ -734,7 +734,15 @@ pub fn gen_func_instance<'ctx>(
|
||||||
let zelf = store.from_unifier_type(&mut ctx.unifier, &ctx.primitives, obj.0, &mut cache);
|
let zelf = store.from_unifier_type(&mut ctx.unifier, &ctx.primitives, obj.0, &mut cache);
|
||||||
let ConcreteTypeEnum::TFunc { args, .. } = &mut signature else { unreachable!() };
|
let ConcreteTypeEnum::TFunc { args, .. } = &mut signature else { unreachable!() };
|
||||||
|
|
||||||
args.insert(0, ConcreteFuncArg { name: "self".into(), ty: zelf, default_value: None });
|
args.insert(
|
||||||
|
0,
|
||||||
|
ConcreteFuncArg {
|
||||||
|
name: "self".into(),
|
||||||
|
ty: zelf,
|
||||||
|
default_value: None,
|
||||||
|
is_vararg: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
let signature = store.add_cty(signature);
|
let signature = store.add_cty(signature);
|
||||||
|
|
||||||
|
|
|
@ -702,7 +702,7 @@ pub fn gen_func_impl<
|
||||||
name: arg.name,
|
name: arg.name,
|
||||||
ty: task.store.to_unifier_type(&mut unifier, &primitives, arg.ty, &mut cache),
|
ty: task.store.to_unifier_type(&mut unifier, &primitives, arg.ty, &mut cache),
|
||||||
default_value: arg.default_value.clone(),
|
default_value: arg.default_value.clone(),
|
||||||
is_vararg: false,
|
is_vararg: arg.is_vararg,
|
||||||
})
|
})
|
||||||
.collect_vec(),
|
.collect_vec(),
|
||||||
task.store.to_unifier_type(&mut unifier, &primitives, *ret, &mut cache),
|
task.store.to_unifier_type(&mut unifier, &primitives, *ret, &mut cache),
|
||||||
|
|
Loading…
Reference in New Issue