Skip to content

Commit

Permalink
execute: Rename resolveField function and update comments (#3159)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Jun 8, 2021
1 parent 6d71a1b commit dc2a3eb
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/execution/execute.ts
Expand Up @@ -142,7 +142,7 @@ export interface ExecutionArgs {
}

/**
* Implements the "Evaluating requests" section of the GraphQL specification.
* Implements the "Executing requests" section of the GraphQL specification.
*
* Returns either a synchronous ExecutionResult (if all encountered resolvers
* are synchronous), or a Promise of an ExecutionResult that will eventually be
Expand Down Expand Up @@ -196,7 +196,7 @@ export function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {
}

/**
* Also implements the "Evaluating requests" section of the GraphQL specification.
* Also implements the "Executing requests" section of the GraphQL specification.
* However, it guarantees to complete synchronously (or throw an error) assuming
* that all field resolvers are also synchronous.
*/
Expand Down Expand Up @@ -327,7 +327,7 @@ export function buildExecutionContext(
}

/**
* Implements the "Evaluating operations" section of the spec.
* Implements the "Executing operations" section of the spec.
*/
function executeOperation(
exeContext: ExecutionContext,
Expand Down Expand Up @@ -367,8 +367,8 @@ function executeOperation(
}

/**
* Implements the "Evaluating selection sets" section of the spec
* for "write" mode.
* Implements the "Executing selection sets" section of the spec
* for fields that must be executed serially.
*/
function executeFieldsSerially(
exeContext: ExecutionContext,
Expand All @@ -381,7 +381,7 @@ function executeFieldsSerially(
fields.entries(),
(results, [responseName, fieldNodes]) => {
const fieldPath = addPath(path, responseName, parentType.name);
const result = resolveField(
const result = executeField(
exeContext,
parentType,
sourceValue,
Expand All @@ -405,8 +405,8 @@ function executeFieldsSerially(
}

/**
* Implements the "Evaluating selection sets" section of the spec
* for "read" mode.
* Implements the "Executing selection sets" section of the spec
* for fields that may be executed in parallel.
*/
function executeFields(
exeContext: ExecutionContext,
Expand All @@ -420,7 +420,7 @@ function executeFields(

for (const [responseName, fieldNodes] of fields.entries()) {
const fieldPath = addPath(path, responseName, parentType.name);
const result = resolveField(
const result = executeField(
exeContext,
parentType,
sourceValue,
Expand Down Expand Up @@ -583,12 +583,12 @@ function getFieldEntryKey(node: FieldNode): string {
}

/**
* Resolves the field on the given source object. In particular, this
* figures out the value that the field returns by calling its resolve function,
* then calls completeValue to complete promises, serialize scalars, or execute
* the sub-selection-set for objects.
* Implements the "Executing field" section of the spec
* In particular, this function figures out the value that the field returns by
* calling its resolve function, then calls completeValue to complete promises,
* serialize scalars, or execute the sub-selection-set for objects.
*/
function resolveField(
function executeField(
exeContext: ExecutionContext,
parentType: GraphQLObjectType,
source: unknown,
Expand Down Expand Up @@ -722,7 +722,7 @@ function handleFieldError(
* and then complete based on that type
*
* Otherwise, the field type expects a sub-selection set, and will complete the
* value by evaluating all sub-selections.
* value by executing all sub-selections.
*/
function completeValue(
exeContext: ExecutionContext,
Expand Down

0 comments on commit dc2a3eb

Please sign in to comment.