From 091a4f097250acbbf76a8dc37ee624f0a49cf617 Mon Sep 17 00:00:00 2001 From: Jianfeng Chen Date: Mon, 26 Jun 2023 11:58:08 -0700 Subject: [PATCH] Allow ast_diff_in_doc drops machine readable struct Reviewed By: schaitoff Differential Revision: D46989358 fbshipit-source-id: ca6d142eaf0696f998aafa9ebb64baa0ae4101b6 --- compiler/crates/graphql-syntax/src/node/executable.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/crates/graphql-syntax/src/node/executable.rs b/compiler/crates/graphql-syntax/src/node/executable.rs index c87203955930f..1ca3881511933 100644 --- a/compiler/crates/graphql-syntax/src/node/executable.rs +++ b/compiler/crates/graphql-syntax/src/node/executable.rs @@ -59,6 +59,13 @@ impl ExecutableDefinition { .any(|d| d.name.value == directive_name), } } + + pub fn selections(&self) -> &[Selection] { + match self { + ExecutableDefinition::Operation(node) => &node.selections.items, + ExecutableDefinition::Fragment(node) => &node.selections.items, + } + } } impl fmt::Debug for ExecutableDefinition {