File tree Expand file tree Collapse file tree 5 files changed +27
-23
lines changed
Expand file tree Collapse file tree 5 files changed +27
-23
lines changed Original file line number Diff line number Diff line change @@ -101,14 +101,20 @@ _Printer_
101101
102102``` js
103103export class Source {
104- constructor (body : string , name ?: string )
104+ constructor (body : string , name ?: string , locationOffset ?: Location )
105+ }
106+
107+ type Location = {
108+ line: number;
109+ column: number;
105110}
106111` ` `
107112
108- A representation of source input to GraphQL. The name is optional,
109- but it is useful for clients who store GraphQL documents in
110- source files; for example, if the GraphQL input is in a file Foo.graphql,
111- it might be useful for ` name` to be "Foo.graphql".
113+ A representation of source input to GraphQL. The ` name` and ` locationOffset` parameters are
114+ optional, but they are useful for clients who store GraphQL documents in source files.
115+ For example, if the GraphQL input starts at line 40 in a file named ` Foo .graphql ` , it might
116+ be useful for ` name` to be ` " Foo.graphql" ` and location to be ` { line: 40 , column: 1 }` .
117+ The ` line` and ` column` properties in ` locationOffset` are 1-indexed.
112118
113119### getLocation
114120
Original file line number Diff line number Diff line change @@ -4,12 +4,11 @@ interface Location {
44}
55
66/**
7- * A representation of source input to GraphQL.
8- * `name` and `locationOffset` are optional. They are useful for clients who
9- * store GraphQL documents in source files; for example, if the GraphQL input
10- * starts at line 40 in a file named Foo.graphql, it might be useful for name to
11- * be "Foo.graphql" and location to be `{ line: 40, column: 0 }`.
12- * line and column in locationOffset are 1-indexed
7+ * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are
8+ * optional, but they are useful for clients who store GraphQL documents in source files.
9+ * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might
10+ * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`.
11+ * The `line` and `column` properties in `locationOffset` are 1-indexed.
1312 */
1413export class Source {
1514 body : string ;
Original file line number Diff line number Diff line change @@ -10,12 +10,11 @@ type Location = {|
1010| } ;
1111
1212/**
13- * A representation of source input to GraphQL.
14- * `name` and `locationOffset` are optional. They are useful for clients who
15- * store GraphQL documents in source files; for example, if the GraphQL input
16- * starts at line 40 in a file named Foo.graphql, it might be useful for name to
17- * be "Foo.graphql" and location to be `{ line: 40, column: 0 }`.
18- * line and column in locationOffset are 1-indexed
13+ * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are
14+ * optional, but they are useful for clients who store GraphQL documents in source files.
15+ * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might
16+ * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`.
17+ * The `line` and `column` properties in `locationOffset` are 1-indexed.
1918 */
2019export class Source {
2120 body : string ;
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ export const QueryDocumentKeys: {
151151export const BREAK : any ;
152152
153153/**
154- * visit() will walk through an AST using a depth first traversal, calling
154+ * visit() will walk through an AST using a depth- first traversal, calling
155155 * the visitor's enter function at each node in the traversal, and calling the
156156 * leave function after visiting that node and all of its child nodes.
157157 *
@@ -185,10 +185,10 @@ export const BREAK: any;
185185 *
186186 * Alternatively to providing enter() and leave() functions, a visitor can
187187 * instead provide functions named the same as the kinds of AST nodes, or
188- * enter/leave visitors at a named key, leading to four permutations of
188+ * enter/leave visitors at a named key, leading to four permutations of the
189189 * visitor API:
190190 *
191- * 1) Named visitors triggered when entering a node a specific kind.
191+ * 1) Named visitors triggered when entering a node of a specific kind.
192192 *
193193 * visit(ast, {
194194 * Kind(node) {
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ export const QueryDocumentKeys: VisitorKeyMap<ASTKindToNode> = {
139139export const BREAK : { ... } = Object . freeze ( { } ) ;
140140
141141/**
142- * visit() will walk through an AST using a depth first traversal, calling
142+ * visit() will walk through an AST using a depth- first traversal, calling
143143 * the visitor's enter function at each node in the traversal, and calling the
144144 * leave function after visiting that node and all of its child nodes.
145145 *
@@ -173,10 +173,10 @@ export const BREAK: { ... } = Object.freeze({});
173173 *
174174 * Alternatively to providing enter() and leave() functions, a visitor can
175175 * instead provide functions named the same as the kinds of AST nodes, or
176- * enter/leave visitors at a named key, leading to four permutations of
176+ * enter/leave visitors at a named key, leading to four permutations of the
177177 * visitor API:
178178 *
179- * 1) Named visitors triggered when entering a node a specific kind.
179+ * 1) Named visitors triggered when entering a node of a specific kind.
180180 *
181181 * visit(ast, {
182182 * Kind(node) {
You can’t perform that action at this time.
0 commit comments