@@ -95,7 +95,7 @@ export class ValidationContext {
95
95
_typeInfo : TypeInfo ;
96
96
_errors : Array < GraphQLError > ;
97
97
_fragments : { [ name : string ] : FragmentDefinition } ;
98
- _fragmentSpreads : Map < HasSelectionSet , Array < FragmentSpread >> ;
98
+ _fragmentSpreads : Map < SelectionSet , Array < FragmentSpread >> ;
99
99
_recursivelyReferencedFragments :
100
100
Map < OperationDefinition , Array < FragmentDefinition >> ;
101
101
_variableUsages : Map < HasSelectionSet , Array < VariableUsage >> ;
@@ -142,11 +142,11 @@ export class ValidationContext {
142
142
return fragments [ name ] ;
143
143
}
144
144
145
- getFragmentSpreads ( node : HasSelectionSet ) : Array < FragmentSpread > {
145
+ getFragmentSpreads ( node : SelectionSet ) : Array < FragmentSpread > {
146
146
let spreads = this . _fragmentSpreads . get ( node ) ;
147
147
if ( ! spreads ) {
148
148
spreads = [ ] ;
149
- const setsToVisit : Array < SelectionSet > = [ node . selectionSet ] ;
149
+ const setsToVisit : Array < SelectionSet > = [ node ] ;
150
150
while ( setsToVisit . length !== 0 ) {
151
151
const set = setsToVisit . pop ( ) ;
152
152
for ( let i = 0 ; i < set . selections . length ; i ++ ) {
@@ -170,7 +170,7 @@ export class ValidationContext {
170
170
if ( ! fragments ) {
171
171
fragments = [ ] ;
172
172
const collectedNames = Object . create ( null ) ;
173
- const nodesToVisit : Array < HasSelectionSet > = [ operation ] ;
173
+ const nodesToVisit : Array < SelectionSet > = [ operation . selectionSet ] ;
174
174
while ( nodesToVisit . length !== 0 ) {
175
175
const node = nodesToVisit . pop ( ) ;
176
176
const spreads = this . getFragmentSpreads ( node ) ;
@@ -181,7 +181,7 @@ export class ValidationContext {
181
181
const fragment = this . getFragment ( fragName ) ;
182
182
if ( fragment ) {
183
183
fragments . push ( fragment ) ;
184
- nodesToVisit . push ( fragment ) ;
184
+ nodesToVisit . push ( fragment . selectionSet ) ;
185
185
}
186
186
}
187
187
}
0 commit comments