Skip to content

Commit e49df49

Browse files
committed
Rename AST nodes to *Node to disambiguate types.
1 parent 361b7a6 commit e49df49

33 files changed

+880
-865
lines changed

src/error/GraphQLError.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
import { getLocation } from '../language';
12-
import type { Node } from '../language/ast';
12+
import type { ASTNode } from '../language/ast';
1313
import type { Source } from '../language/source';
1414

1515
/**
@@ -50,7 +50,7 @@ declare class GraphQLError extends Error {
5050
/**
5151
* An array of GraphQL AST Nodes corresponding to this error.
5252
*/
53-
nodes: Array<Node> | void;
53+
nodes: Array<ASTNode> | void;
5454

5555
/**
5656
* The source GraphQL document corresponding to this error.

src/error/__tests__/GraphQLError-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ describe('GraphQLError', () => {
6464
field
6565
}`);
6666
const ast = parse(source);
67-
const fieldAST = ast.definitions[0].selectionSet.selections[0];
68-
const e = new GraphQLError('msg', [ fieldAST ]);
69-
expect(e.nodes).to.deep.equal([ fieldAST ]);
67+
const fieldNode = ast.definitions[0].selectionSet.selections[0];
68+
const e = new GraphQLError('msg', [ fieldNode ]);
69+
expect(e.nodes).to.deep.equal([ fieldNode ]);
7070
expect(e.source).to.equal(source);
7171
expect(e.positions).to.deep.equal([ 8 ]);
7272
expect(e.locations).to.deep.equal([ { line: 2, column: 7 } ]);
@@ -77,9 +77,9 @@ describe('GraphQLError', () => {
7777
field
7878
}`);
7979
const ast = parse(source);
80-
const operationAST = ast.definitions[0];
81-
const e = new GraphQLError('msg', [ operationAST ]);
82-
expect(e.nodes).to.deep.equal([ operationAST ]);
80+
const operationNode = ast.definitions[0];
81+
const e = new GraphQLError('msg', [ operationNode ]);
82+
expect(e.nodes).to.deep.equal([ operationNode ]);
8383
expect(e.source).to.equal(source);
8484
expect(e.positions).to.deep.equal([ 0 ]);
8585
expect(e.locations).to.deep.equal([ { line: 1, column: 1 } ]);

src/execution/__tests__/executor-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ describe('Execute: Handles basic execution tasks', () => {
208208

209209
expect(Object.keys(info)).to.deep.equal([
210210
'fieldName',
211-
'fieldASTs',
211+
'fieldNodes',
212212
'returnType',
213213
'parentType',
214214
'path',
@@ -219,8 +219,8 @@ describe('Execute: Handles basic execution tasks', () => {
219219
'variableValues',
220220
]);
221221
expect(info.fieldName).to.equal('test');
222-
expect(info.fieldASTs).to.have.lengthOf(1);
223-
expect(info.fieldASTs[0]).to.equal(
222+
expect(info.fieldNodes).to.have.lengthOf(1);
223+
expect(info.fieldNodes[0]).to.equal(
224224
ast.definitions[0].selectionSet.selections[0]
225225
);
226226
expect(info.returnType).to.equal(GraphQLString);

0 commit comments

Comments
 (0)