Skip to content

Commit c343454

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

File tree

1 file changed

+3
-27
lines changed

1 file changed

+3
-27
lines changed

src/execution/values.ts

Lines changed: 3 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,12 @@ 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-
}
294+
298295
} else if (
299296
variableValues != null &&
300297
Object.hasOwn(variableValues, variableName)
301298
) {
302299
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;
315300
}
316301
}
317302

@@ -332,15 +317,6 @@ export function getArgumentValuesFromSpread(
332317
});
333318
}
334319

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-
}
344320
coercedValues[name] = coercedValue;
345321
}
346322
return coercedValues;

0 commit comments

Comments
 (0)