Merge remote-tracking branch 'upstream/async-await' into async-await

This commit is contained in:
nWacky 2019-11-01 16:22:39 +03:00
commit 563e44c2ac
No known key found for this signature in database
GPG key ID: 22EF2C62F6F79FD0

View file

@ -41,11 +41,18 @@ pub fn build_object(args: TokenStream, body: TokenStream, is_internal: bool) ->
}
}
let name = if let Some(ident) = util::name_of_type(&*_impl.self_ty) {
ident
} else {
panic!("Could not determine a name for the object type: specify one with #[juniper::object(name = \"SomeName\")");
};
let name =
if let Some(name) = impl_attrs.name.as_ref(){
name.to_string()
}
else {
if let Some(ident) = util::name_of_type(&*_impl.self_ty) {
ident.to_string()
} else {
panic!("Could not determine a name for the object type: specify one with #[juniper::object(name = \"SomeName\")");
}
};
let target_type = *_impl.self_ty.clone();
@ -54,7 +61,7 @@ pub fn build_object(args: TokenStream, body: TokenStream, is_internal: bool) ->
.or(util::get_doc_comment(&_impl.attrs));
let mut definition = util::GraphQLTypeDefiniton {
name: name.to_string(),
name: name,
_type: target_type.clone(),
context: impl_attrs.context,
scalar: impl_attrs.scalar,