Make to_idl_type infallible

This commit makes the `to_idl_type` infallible, returning a new enum
variant, `UnknownInterface`, in the one location that we still return
`None`. By making this infallible we can ensure that expansion of unions
which have unknown types still generate methods for all the variants
which we actually have all the methods for!
This commit is contained in:
Alex Crichton
2018-11-07 10:37:43 -08:00
parent ac6a230d83
commit 176eedc63b
3 changed files with 66 additions and 78 deletions

View File

@ -353,7 +353,7 @@ impl<'src> FirstPassRecord<'src> {
// use argument position now as we're just binding setters
let ty = field
.type_
.to_idl_type(self)?
.to_idl_type(self)
.to_syn_type(TypePosition::Argument)?;
// Slice types aren't supported because they don't implement
@ -459,11 +459,7 @@ impl<'src> FirstPassRecord<'src> {
self_name: &'src str,
member: &'src weedle::interface::ConstMember<'src>,
) {
let idl_type = match member.const_type.to_idl_type(self) {
Some(idl_type) => idl_type,
None => return,
};
let idl_type = member.const_type.to_idl_type(self);
let ty = match idl_type.to_syn_type(TypePosition::Return) {
Some(ty) => ty,
None => {