Skip to content

Commit 0195b30

Browse files
committed
Execute: use consistent name for execution context
1 parent 3cb4500 commit 0195b30

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/execution/execute.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function executeImpl(
195195

196196
// If a valid context cannot be created due to incorrect arguments,
197197
// a "Response" with only errors is returned.
198-
const context = buildExecutionContext(
198+
const exeContext = buildExecutionContext(
199199
schema,
200200
document,
201201
rootValue,
@@ -206,8 +206,8 @@ function executeImpl(
206206
);
207207

208208
// Return early errors if execution context failed.
209-
if (Array.isArray(context)) {
210-
return { errors: context };
209+
if (Array.isArray(exeContext)) {
210+
return { errors: exeContext };
211211
}
212212

213213
// Return a Promise that will eventually resolve to the data described by
@@ -217,24 +217,24 @@ function executeImpl(
217217
// field and its descendants will be omitted, and sibling fields will still
218218
// be executed. An execution which encounters errors will still result in a
219219
// resolved Promise.
220-
const data = executeOperation(context, context.operation, rootValue);
221-
return buildResponse(context, data);
220+
const data = executeOperation(exeContext, rootValue);
221+
return buildResponse(exeContext, data);
222222
}
223223

224224
/**
225225
* Given a completed execution context and data, build the { errors, data }
226226
* response defined by the "Response" section of the GraphQL specification.
227227
*/
228228
function buildResponse(
229-
context: ExecutionContext,
229+
exeContext: ExecutionContext,
230230
data: MaybePromise<ObjMap<mixed> | null>,
231231
) {
232232
if (isPromise(data)) {
233-
return data.then(resolved => buildResponse(context, resolved));
233+
return data.then(resolved => buildResponse(exeContext, resolved));
234234
}
235-
return context.errors.length === 0
235+
return exeContext.errors.length === 0
236236
? { data }
237-
: { errors: context.errors, data };
237+
: { errors: exeContext.errors, data };
238238
}
239239

240240
/**
@@ -378,9 +378,9 @@ export function buildExecutionContext(
378378
*/
379379
function executeOperation(
380380
exeContext: ExecutionContext,
381-
operation: OperationDefinitionNode,
382381
rootValue: mixed,
383382
): MaybePromise<ObjMap<mixed> | null> {
383+
const operation = exeContext.operation;
384384
const type = getOperationRootType(exeContext.schema, operation);
385385
const fields = collectFields(
386386
exeContext,

0 commit comments

Comments
 (0)