@@ -58,7 +58,7 @@ export function VariablesInAllowedPosition(
58
58
const varType = typeFromAST ( schema , varDef . type ) ;
59
59
if (
60
60
varType &&
61
- ! allowedInPosition (
61
+ ! allowedVariableUsage (
62
62
schema ,
63
63
varType ,
64
64
varDef . defaultValue ,
@@ -84,26 +84,26 @@ export function VariablesInAllowedPosition(
84
84
}
85
85
86
86
/**
87
- * Returns true if the variable is allowed in the position it was found,
87
+ * Returns true if the variable is allowed in the location it was found,
88
88
* which includes considering if default values exist for either the variable
89
89
* or the location at which it is located.
90
90
*/
91
- function allowedInPosition (
91
+ function allowedVariableUsage (
92
92
schema : GraphQLSchema ,
93
93
varType : GraphQLType ,
94
94
varDefaultValue : ?ValueNode ,
95
95
locationType : GraphQLType ,
96
96
locationDefaultValue : ?mixed ,
97
97
) : boolean {
98
98
if ( isNonNullType ( locationType ) && ! isNonNullType ( varType ) ) {
99
- const hasLocationDefaultValue = locationDefaultValue !== undefined ;
100
99
const hasNonNullVariableDefaultValue =
101
100
varDefaultValue && varDefaultValue . kind !== Kind . NULL ;
102
- if ( ! hasLocationDefaultValue && ! hasNonNullVariableDefaultValue ) {
101
+ const hasLocationDefaultValue = locationDefaultValue !== undefined ;
102
+ if ( ! hasNonNullVariableDefaultValue && ! hasLocationDefaultValue ) {
103
103
return false ;
104
104
}
105
- const locationNullableType = locationType . ofType ;
106
- return isTypeSubTypeOf ( schema , varType , locationNullableType ) ;
105
+ const nullableLocationType = locationType . ofType ;
106
+ return isTypeSubTypeOf ( schema , varType , nullableLocationType ) ;
107
107
}
108
108
return isTypeSubTypeOf ( schema , varType , locationType ) ;
109
109
}
0 commit comments