mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(query): add name to interface (#716)
This commit is contained in:
parent
a953a96529
commit
c7fc1d99b5
3 changed files with 24 additions and 0 deletions
|
|
@ -106,6 +106,11 @@ impl<'a, 'b: 'a> trustfall::provider::Adapter<'a> for &'a Adapter<'b> {
|
|||
property_name.as_ref(),
|
||||
resolve_info,
|
||||
),
|
||||
"InterfaceAST" | "Interface" => super::properties::resolve_interface_property(
|
||||
contexts,
|
||||
property_name.as_ref(),
|
||||
resolve_info,
|
||||
),
|
||||
"InterfaceExtend" => super::properties::resolve_interface_extend_property(
|
||||
contexts,
|
||||
property_name.as_ref(),
|
||||
|
|
|
|||
|
|
@ -228,6 +228,23 @@ pub(super) fn resolve_import_property<'a, 'b: 'a>(
|
|||
}
|
||||
}
|
||||
|
||||
pub(super) fn resolve_interface_property<'a, 'b: 'a>(
|
||||
contexts: ContextIterator<'a, Vertex<'b>>,
|
||||
property_name: &str,
|
||||
_resolve_info: &ResolveInfo,
|
||||
) -> ContextOutcomeIterator<'a, Vertex<'b>, FieldValue> {
|
||||
match property_name {
|
||||
"name" => resolve_property_with(contexts, |v| {
|
||||
v.as_interface().unwrap().interface.id.name.to_string().into()
|
||||
}),
|
||||
_ => {
|
||||
unreachable!(
|
||||
"attempted to read unexpected property '{property_name}' on type 'InterfaceExtend'"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn resolve_interface_extend_property<'a, 'b: 'a>(
|
||||
contexts: ContextIterator<'a, Vertex<'b>>,
|
||||
property_name: &str,
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ interface InterfaceExtend {
|
|||
}
|
||||
|
||||
interface Interface {
|
||||
name: String!
|
||||
extend: [InterfaceExtend!]!
|
||||
name_span: Span!
|
||||
entire_span: Span!
|
||||
|
|
@ -355,6 +356,7 @@ type TypeAnnotationAST implements TypeAnnotation & ASTNode & HasSpan {
|
|||
}
|
||||
|
||||
type InterfaceAST implements Interface & ASTNode & HasSpan {
|
||||
name: String!
|
||||
extend: [InterfaceExtend!]!
|
||||
name_span: Span!
|
||||
entire_span: Span!
|
||||
|
|
|
|||
Loading…
Reference in a new issue