Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions src/language/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class Parser {
return {
kind: Kind.ARGUMENT,
name: this.parseName(),
value: (this.expectToken(TokenKind.COLON), this.parseConstValue()),
value: (this.expectToken(TokenKind.COLON), this.parseValueLiteral(true)),
loc: this.loc(start),
};
}
Expand Down Expand Up @@ -597,22 +597,14 @@ class Parser {
};
}

parseConstValue(): ValueNode {
return this.parseValueLiteral(true);
}

parseValueValue(): ValueNode {
return this.parseValueLiteral(false);
}

/**
* ListValue[Const] :
* - [ ]
* - [ Value[?Const]+ ]
*/
parseList(isConst: boolean): ListValueNode {
const start = this._lexer.token;
const item = isConst ? this.parseConstValue : this.parseValueValue;
const item = () => this.parseValueLiteral(isConst);
return {
kind: Kind.LIST,
values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R),
Expand Down Expand Up @@ -949,7 +941,7 @@ class Parser {
const type = this.parseTypeReference();
let defaultValue;
if (this.expectOptionalToken(TokenKind.EQUALS)) {
defaultValue = this.parseConstValue();
defaultValue = this.parseValueLiteral(true);
}
const directives = this.parseDirectives(true);
return {
Expand Down