12345678910111213141516171819202122232425262728293031323334353637383940 |
- import devAssert from '../jsutils/devAssert';
- import defineToStringTag from '../jsutils/defineToStringTag';
- type Location = {|
- line: number,
- column: number,
- |};
- export class Source {
- body: string;
- name: string;
- locationOffset: Location;
- constructor(body: string, name?: string, locationOffset?: Location): void {
- this.body = body;
- this.name = name || 'GraphQL request';
- this.locationOffset = locationOffset || { line: 1, column: 1 };
- devAssert(
- this.locationOffset.line > 0,
- 'line in locationOffset is 1-indexed and must be positive',
- );
- devAssert(
- this.locationOffset.column > 0,
- 'column in locationOffset is 1-indexed and must be positive',
- );
- }
- }
- defineToStringTag(Source);
|