@@ -300,12 +300,7 @@ fn resolve_selection_set_into<T, CtxT>(
300
300
for selection in selection_set {
301
301
match selection {
302
302
& Selection :: Field ( Spanning { item : ref f, start : ref start_pos, .. } ) => {
303
- if is_excluded (
304
- & match & f. directives {
305
- & Some ( ref sel) => Some ( sel. iter ( ) . cloned ( ) . map ( |s| s. item ) . collect ( ) ) ,
306
- & None => None ,
307
- } ,
308
- executor. variables ( ) ) {
303
+ if is_excluded ( & f. directives , executor. variables ( ) ) {
309
304
continue ;
310
305
}
311
306
@@ -347,12 +342,7 @@ fn resolve_selection_set_into<T, CtxT>(
347
342
}
348
343
} ,
349
344
& Selection :: FragmentSpread ( Spanning { item : ref spread, .. } ) => {
350
- if is_excluded (
351
- & match & spread. directives {
352
- & Some ( ref sel) => Some ( sel. iter ( ) . cloned ( ) . map ( |s| s. item ) . collect ( ) ) ,
353
- & None => None ,
354
- } ,
355
- executor. variables ( ) ) {
345
+ if is_excluded ( & spread. directives , executor. variables ( ) ) {
356
346
continue ;
357
347
}
358
348
@@ -363,12 +353,7 @@ fn resolve_selection_set_into<T, CtxT>(
363
353
instance, & fragment. selection_set [ ..] , executor, result) ;
364
354
} ,
365
355
& Selection :: InlineFragment ( Spanning { item : ref fragment, start : ref start_pos, .. } ) => {
366
- if is_excluded (
367
- & match & fragment. directives {
368
- & Some ( ref sel) => Some ( sel. iter ( ) . cloned ( ) . map ( |s| s. item ) . collect ( ) ) ,
369
- & None => None
370
- } ,
371
- executor. variables ( ) ) {
356
+ if is_excluded ( & fragment. directives , executor. variables ( ) ) {
372
357
continue ;
373
358
}
374
359
@@ -404,9 +389,9 @@ fn resolve_selection_set_into<T, CtxT>(
404
389
}
405
390
}
406
391
407
- fn is_excluded ( directives : & Option < Vec < Directive > > , vars : & HashMap < String , InputValue > ) -> bool {
392
+ fn is_excluded ( directives : & Option < Vec < Spanning < Directive > > > , vars : & HashMap < String , InputValue > ) -> bool {
408
393
if let Some ( ref directives) = * directives {
409
- for directive in directives {
394
+ for & Spanning { item : ref directive, .. } in directives {
410
395
let condition: bool = directive. arguments . iter ( )
411
396
. flat_map ( |m| m. item . get ( "if" ) )
412
397
. flat_map ( |v| v. item . clone ( ) . into_const ( vars) . convert ( ) )
0 commit comments