Skip to content

Commit d5ad911

Browse files
committed
remove unused code, TODO: double check whether we deleted crucial branches
1 parent eb0d997 commit d5ad911

File tree

2 files changed

+3
-32
lines changed

2 files changed

+3
-32
lines changed

src/execution/collectFields.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,7 @@ export function collectFields(
7474
visitedFragmentNames: new Set(),
7575
};
7676

77-
collectFieldsImpl(
78-
context,
79-
operation.selectionSet,
80-
groupedFieldSet,
81-
);
77+
collectFieldsImpl(context, operation.selectionSet, groupedFieldSet);
8278
return groupedFieldSet;
8379
}
8480

src/execution/values.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function coerceVariableValues(
160160
*/
161161
export function getArgumentValues(
162162
node: FieldNode | DirectiveNode,
163-
argDefs: ReadonlyArray<GraphQLArgument> | undefined,
163+
argDefs: ReadonlyArray<GraphQLArgument>,
164164
variableValues: Maybe<ObjMap<unknown>>,
165165
fragmentArgValues?: Maybe<ObjMap<unknown>>,
166166
): { [argument: string]: unknown } {
@@ -169,7 +169,7 @@ export function getArgumentValues(
169169
node.arguments?.map((arg) => [arg.name.value, arg]),
170170
);
171171

172-
for (const argDef of argDefs ?? []) {
172+
for (const argDef of argDefs) {
173173
const name = argDef.name;
174174
const argType = argDef.type;
175175
const argumentNode = argNodeMap.get(name);
@@ -291,27 +291,11 @@ export function getArgumentValuesFromSpread(
291291
Object.hasOwn(fragmentArgValues, variableName)
292292
) {
293293
hasValue = fragmentArgValues[variableName] != null;
294-
if (!hasValue && varDef.defaultValue !== undefined) {
295-
coercedValues[name] = valueFromASTUntyped(varDef.defaultValue);
296-
continue;
297-
}
298294
} else if (
299295
variableValues != null &&
300296
Object.hasOwn(variableValues, variableName)
301297
) {
302298
hasValue = variableValues[variableName] != null;
303-
} else if (varDef.defaultValue !== undefined) {
304-
coercedValues[name] = valueFromASTUntyped(varDef.defaultValue);
305-
continue;
306-
} else if (isNonNullType(argType)) {
307-
throw new GraphQLError(
308-
`Argument "${name}" of required type "${inspect(argType)}" ` +
309-
`was provided the variable "$${variableName}" which was not provided a runtime value.`,
310-
{ nodes: valueNode },
311-
);
312-
} else {
313-
coercedValues[name] = undefined;
314-
hasValue = false;
315299
}
316300
}
317301

@@ -332,15 +316,6 @@ export function getArgumentValuesFromSpread(
332316
});
333317
}
334318

335-
if (coercedValue === undefined) {
336-
// Note: ValuesOfCorrectTypeRule validation should catch this before
337-
// execution. This is a runtime check to ensure execution does not
338-
// continue with an invalid argument value.
339-
throw new GraphQLError(
340-
`Argument "${name}" has invalid value ${print(valueNode)}.`,
341-
{ nodes: valueNode },
342-
);
343-
}
344319
coercedValues[name] = coercedValue;
345320
}
346321
return coercedValues;

0 commit comments

Comments
 (0)