Use anyref helper to reduce some code duplication

This commit is contained in:
Alex Crichton 2018-09-20 17:26:49 -07:00
parent a85e49a2b4
commit a2d6a8ff53

View File

@ -517,11 +517,7 @@ impl<'a> IdlType<'a> {
| IdlType::Dictionary(name)
| IdlType::CallbackInterface { name, .. } => {
let ty = ident_ty(rust_ident(camel_case_ident(name).as_str()));
if pos == TypePosition::Argument {
Some(shared_ref(ty, false))
} else {
Some(ty)
}
anyref(ty)
},
IdlType::Enum(name) => Some(ident_ty(rust_ident(camel_case_ident(name).as_str()))),