compiler: Put the argument names in the Type

That simplifies things a bit and will allow to have names for builtin callback and functions
This commit is contained in:
Olivier Goffart 2024-11-20 17:02:16 +01:00
parent b6baa4a587
commit f225f79d49
12 changed files with 116 additions and 183 deletions

View file

@ -1172,10 +1172,22 @@ impl Element {
.ReturnType()
.map(|ret_ty| type_from_node(ret_ty.Type(), diag, tr))
.unwrap_or(Type::Void);
let arg_names = sig_decl
.CallbackDeclarationParameter()
.map(|a| {
a.DeclaredIdentifier()
.and_then(|x| parser::identifier_text(&x))
.unwrap_or_default()
})
.collect();
r.property_declarations.insert(
name,
PropertyDeclaration {
property_type: Type::Callback(Rc::new(Function { return_type, args })),
property_type: Type::Callback(Rc::new(Function {
return_type,
args,
arg_names,
})),
node: Some(sig_decl.into()),
visibility: PropertyVisibility::InOut,
pure,
@ -1256,7 +1268,11 @@ impl Element {
r.property_declarations.insert(
name,
PropertyDeclaration {
property_type: Type::Function(Rc::new(Function { return_type, args })),
property_type: Type::Function(Rc::new(Function {
return_type,
args,
arg_names,
})),
node: Some(func.into()),
visibility,
pure,