Skip to content

Commit

Permalink
Sync JSDoc comments with docs changes (#2681)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrearden committed Jul 1, 2020
1 parent 5aba9c9 commit 38b4f9e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
16 changes: 11 additions & 5 deletions docs/APIReference-Language.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,20 @@ _Printer_

```js
export class Source {
constructor(body: string, name?: string)
constructor(body: string, name?: string, locationOffset?: Location)
}

type Location = {
line: number;
column: number;
}
```
A representation of source input to GraphQL. The name is optional,
but it is useful for clients who store GraphQL documents in
source files; for example, if the GraphQL input is in a file Foo.graphql,
it might be useful for `name` to be "Foo.graphql".
A representation of source input to GraphQL. The `name` and `locationOffset` parameters are
optional, but they are useful for clients who store GraphQL documents in source files.
For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might
be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`.
The `line` and `column` properties in `locationOffset` are 1-indexed.
### getLocation
Expand Down
11 changes: 5 additions & 6 deletions src/language/source.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ interface Location {
}

/**
* A representation of source input to GraphQL.
* `name` and `locationOffset` are optional. They are useful for clients who
* store GraphQL documents in source files; for example, if the GraphQL input
* starts at line 40 in a file named Foo.graphql, it might be useful for name to
* be "Foo.graphql" and location to be `{ line: 40, column: 0 }`.
* line and column in locationOffset are 1-indexed
* A representation of source input to GraphQL. The `name` and `locationOffset` parameters are
* optional, but they are useful for clients who store GraphQL documents in source files.
* For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might
* be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`.
* The `line` and `column` properties in `locationOffset` are 1-indexed.
*/
export class Source {
body: string;
Expand Down
11 changes: 5 additions & 6 deletions src/language/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ type Location = {|
|};

/**
* A representation of source input to GraphQL.
* `name` and `locationOffset` are optional. They are useful for clients who
* store GraphQL documents in source files; for example, if the GraphQL input
* starts at line 40 in a file named Foo.graphql, it might be useful for name to
* be "Foo.graphql" and location to be `{ line: 40, column: 0 }`.
* line and column in locationOffset are 1-indexed
* A representation of source input to GraphQL. The `name` and `locationOffset` parameters are
* optional, but they are useful for clients who store GraphQL documents in source files.
* For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might
* be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`.
* The `line` and `column` properties in `locationOffset` are 1-indexed.
*/
export class Source {
body: string;
Expand Down
6 changes: 3 additions & 3 deletions src/language/visitor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const QueryDocumentKeys: {
export const BREAK: any;

/**
* visit() will walk through an AST using a depth first traversal, calling
* visit() will walk through an AST using a depth-first traversal, calling
* the visitor's enter function at each node in the traversal, and calling the
* leave function after visiting that node and all of its child nodes.
*
Expand Down Expand Up @@ -185,10 +185,10 @@ export const BREAK: any;
*
* Alternatively to providing enter() and leave() functions, a visitor can
* instead provide functions named the same as the kinds of AST nodes, or
* enter/leave visitors at a named key, leading to four permutations of
* enter/leave visitors at a named key, leading to four permutations of the
* visitor API:
*
* 1) Named visitors triggered when entering a node a specific kind.
* 1) Named visitors triggered when entering a node of a specific kind.
*
* visit(ast, {
* Kind(node) {
Expand Down
6 changes: 3 additions & 3 deletions src/language/visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const QueryDocumentKeys: VisitorKeyMap<ASTKindToNode> = {
export const BREAK: { ... } = Object.freeze({});

/**
* visit() will walk through an AST using a depth first traversal, calling
* visit() will walk through an AST using a depth-first traversal, calling
* the visitor's enter function at each node in the traversal, and calling the
* leave function after visiting that node and all of its child nodes.
*
Expand Down Expand Up @@ -173,10 +173,10 @@ export const BREAK: { ... } = Object.freeze({});
*
* Alternatively to providing enter() and leave() functions, a visitor can
* instead provide functions named the same as the kinds of AST nodes, or
* enter/leave visitors at a named key, leading to four permutations of
* enter/leave visitors at a named key, leading to four permutations of the
* visitor API:
*
* 1) Named visitors triggered when entering a node a specific kind.
* 1) Named visitors triggered when entering a node of a specific kind.
*
* visit(ast, {
* Kind(node) {
Expand Down

0 comments on commit 38b4f9e

Please sign in to comment.