Merge the Callback and Function type

There is no need for two of these
This simplify some code

Amend efdecf0a13
This commit is contained in:
Olivier Goffart 2024-10-28 14:36:30 +01:00 committed by GitHub
parent dff19c52da
commit 6bb0e6038f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 72 additions and 135 deletions

View file

@ -27,7 +27,7 @@ pub enum Type {
/// The type of a callback alias whose type was not yet inferred
InferredCallback,
Callback(Rc<Callback>),
Callback(Rc<Function>),
Function(Rc<Function>),
ComponentFactory,
@ -127,9 +127,7 @@ impl Display for Type {
}
write!(f, ")")?
}
if let Some(rt) = &callback.return_type {
write!(f, "-> {}", rt)?;
}
write!(f, "-> {}", callback.return_type)?;
Ok(())
}
Type::ComponentFactory => write!(f, "component-factory"),
@ -782,12 +780,6 @@ impl<'a> PropertyLookupResult<'a> {
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Callback {
pub return_type: Option<Type>,
pub args: Vec<Type>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Function {
pub return_type: Type,