Remove "new "

This commit is contained in:
Tobe O 2019-08-07 22:24:19 -04:00
parent 6455dde6b6
commit 766ec56f57
17 changed files with 97 additions and 97 deletions

View file

@ -33,7 +33,7 @@ import 'package:graphql_parser/graphql_parser.dart';
doSomething(String text) { doSomething(String text) {
var tokens = scan(text); var tokens = scan(text);
var parser = new Parser(tokens); var parser = Parser(tokens);
if (parser.errors.isNotEmpty) { if (parser.errors.isNotEmpty) {
// Handle errors... // Handle errors...

View file

@ -11,7 +11,7 @@ final String text = '''
main() { main() {
var tokens = scan(text); var tokens = scan(text);
var parser = new Parser(tokens); var parser = Parser(tokens);
var doc = parser.parseDocument(); var doc = parser.parseDocument();
var operation = doc.definitions.first as OperationDefinitionContext; var operation = doc.definitions.first as OperationDefinitionContext;

View file

@ -24,7 +24,7 @@ class StringValueContext extends InputValueContext<String> {
} }
var codeUnits = text.codeUnits; var codeUnits = text.codeUnits;
var buf = new StringBuffer(); var buf = StringBuffer();
for (int i = 0; i < codeUnits.length; i++) { for (int i = 0; i < codeUnits.length; i++) {
var ch = codeUnits[i]; var ch = codeUnits[i];
@ -35,9 +35,9 @@ class StringValueContext extends InputValueContext<String> {
c2 = codeUnits[++i], c2 = codeUnits[++i],
c3 = codeUnits[++i], c3 = codeUnits[++i],
c4 = codeUnits[++i]; c4 = codeUnits[++i];
var hexString = new String.fromCharCodes([c1, c2, c3, c4]); var hexString = String.fromCharCodes([c1, c2, c3, c4]);
var hexNumber = int.parse(hexString, radix: 16); var hexNumber = int.parse(hexString, radix: 16);
buf.write(new String.fromCharCode(hexNumber)); buf.write(String.fromCharCode(hexNumber));
continue; continue;
} }
@ -64,7 +64,7 @@ class StringValueContext extends InputValueContext<String> {
buf.writeCharCode(next); buf.writeCharCode(next);
} }
} else } else
throw new SyntaxError('Unexpected "\\" in string literal.', span); throw SyntaxError('Unexpected "\\" in string literal.', span);
} else { } else {
buf.writeCharCode(ch); buf.writeCharCode(ch);
} }

View file

@ -14,5 +14,5 @@ class VariableContext extends InputValueContext<Object> {
@override @override
Object computeValue(Map<String, dynamic> variables) => variables[name]; Object computeValue(Map<String, dynamic> variables) => variables[name];
// new FileSpan(DOLLAR?.span?.start, NAME?.span?.end, toSource()); // FileSpan(DOLLAR?.span?.start, NAME?.span?.end, toSource());
} }

View file

@ -4,14 +4,14 @@ import 'syntax_error.dart';
import 'token.dart'; import 'token.dart';
import 'token_type.dart'; import 'token_type.dart';
final RegExp _comment = new RegExp(r'#[^\n]*'); final RegExp _comment = RegExp(r'#[^\n]*');
final RegExp _whitespace = new RegExp('[ \t\n\r]+'); final RegExp _whitespace = RegExp('[ \t\n\r]+');
// final RegExp _boolean = new RegExp(r'true|false'); // final RegExp _boolean = RegExp(r'true|false');
final RegExp _number = new RegExp(r'-?[0-9]+(\.[0-9]+)?(E|e(\+|-)?[0-9]+)?'); final RegExp _number = RegExp(r'-?[0-9]+(\.[0-9]+)?(E|e(\+|-)?[0-9]+)?');
final RegExp _string = new RegExp( final RegExp _string = RegExp(
r'"((\\(["\\/bfnrt]|(u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))|([^"\\]))*"'); r'"((\\(["\\/bfnrt]|(u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))|([^"\\]))*"');
final RegExp _blockString = new RegExp(r'"""(([^"])|(\\"""))*"""'); final RegExp _blockString = RegExp(r'"""(([^"])|(\\"""))*"""');
final RegExp _name = new RegExp(r'[_A-Za-z][_0-9A-Za-z]*'); final RegExp _name = RegExp(r'[_A-Za-z][_0-9A-Za-z]*');
final Map<Pattern, TokenType> _patterns = { final Map<Pattern, TokenType> _patterns = {
'@': TokenType.ARROBA, '@': TokenType.ARROBA,
@ -42,7 +42,7 @@ final Map<Pattern, TokenType> _patterns = {
List<Token> scan(String text, {sourceUrl}) { List<Token> scan(String text, {sourceUrl}) {
List<Token> out = []; List<Token> out = [];
var scanner = new SpanScanner(text, sourceUrl: sourceUrl); var scanner = SpanScanner(text, sourceUrl: sourceUrl);
while (!scanner.isDone) { while (!scanner.isDone) {
List<Token> potential = []; List<Token> potential = [];
@ -54,14 +54,14 @@ List<Token> scan(String text, {sourceUrl}) {
for (var pattern in _patterns.keys) { for (var pattern in _patterns.keys) {
if (scanner.matches(pattern)) { if (scanner.matches(pattern)) {
potential.add(new Token( potential.add(Token(
_patterns[pattern], scanner.lastMatch[0], scanner.lastSpan)); _patterns[pattern], scanner.lastMatch[0], scanner.lastSpan));
} }
} }
if (potential.isEmpty) { if (potential.isEmpty) {
var ch = new String.fromCharCode(scanner.readChar()); var ch = String.fromCharCode(scanner.readChar());
throw new SyntaxError("Unexpected token '$ch'.", scanner.emptySpan); throw SyntaxError("Unexpected token '$ch'.", scanner.emptySpan);
} else { } else {
// Choose longest token // Choose longest token
potential.sort((a, b) => b.text.length.compareTo(a.text.length)); potential.sort((a, b) => b.text.length.compareTo(a.text.length));

View file

@ -60,7 +60,7 @@ class Parser {
def = parseDefinition(); def = parseDefinition();
} }
return new DocumentContext()..definitions.addAll(defs); return DocumentContext()..definitions.addAll(defs);
} }
DefinitionContext parseDefinition() => DefinitionContext parseDefinition() =>
@ -69,7 +69,7 @@ class Parser {
OperationDefinitionContext parseOperationDefinition() { OperationDefinitionContext parseOperationDefinition() {
var selectionSet = parseSelectionSet(); var selectionSet = parseSelectionSet();
if (selectionSet != null) if (selectionSet != null)
return new OperationDefinitionContext(null, null, null, selectionSet); return OperationDefinitionContext(null, null, null, selectionSet);
else { else {
if (nextName('mutation') || if (nextName('mutation') ||
nextName('query') || nextName('query') ||
@ -80,11 +80,11 @@ class Parser {
var dirs = parseDirectives(); var dirs = parseDirectives();
var selectionSet = parseSelectionSet(); var selectionSet = parseSelectionSet();
if (selectionSet != null) if (selectionSet != null)
return new OperationDefinitionContext( return OperationDefinitionContext(
TYPE, NAME, variables, selectionSet) TYPE, NAME, variables, selectionSet)
..directives.addAll(dirs); ..directives.addAll(dirs);
else { else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing selection set in fragment definition.', 'Missing selection set in fragment definition.',
NAME?.span ?? TYPE.span)); NAME?.span ?? TYPE.span));
return null; return null;
@ -106,29 +106,29 @@ class Parser {
var dirs = parseDirectives(); var dirs = parseDirectives();
var selectionSet = parseSelectionSet(); var selectionSet = parseSelectionSet();
if (selectionSet != null) if (selectionSet != null)
return new FragmentDefinitionContext( return FragmentDefinitionContext(
FRAGMENT, NAME, ON, typeCondition, selectionSet) FRAGMENT, NAME, ON, typeCondition, selectionSet)
..directives.addAll(dirs); ..directives.addAll(dirs);
else { else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Expected selection set in fragment definition.', 'Expected selection set in fragment definition.',
typeCondition.span)); typeCondition.span));
return null; return null;
} }
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Expected type condition after "on" in fragment definition.', 'Expected type condition after "on" in fragment definition.',
ON.span)); ON.span));
return null; return null;
} }
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Expected "on" after name "${NAME.text}" in fragment definition.', 'Expected "on" after name "${NAME.text}" in fragment definition.',
NAME.span)); NAME.span));
return null; return null;
} }
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Expected name after "fragment" in fragment definition.', 'Expected name after "fragment" in fragment definition.',
FRAGMENT.span)); FRAGMENT.span));
return null; return null;
@ -142,7 +142,7 @@ class Parser {
var ELLIPSIS = current; var ELLIPSIS = current;
if (next(TokenType.NAME, exclude: ['on'])) { if (next(TokenType.NAME, exclude: ['on'])) {
var NAME = current; var NAME = current;
return new FragmentSpreadContext(ELLIPSIS, NAME) return FragmentSpreadContext(ELLIPSIS, NAME)
..directives.addAll(parseDirectives()); ..directives.addAll(parseDirectives());
} else { } else {
_index--; _index--;
@ -162,11 +162,11 @@ class Parser {
var directives = parseDirectives(); var directives = parseDirectives();
var selectionSet = parseSelectionSet(); var selectionSet = parseSelectionSet();
if (selectionSet != null) { if (selectionSet != null) {
return new InlineFragmentContext( return InlineFragmentContext(
ELLIPSIS, ON, typeCondition, selectionSet) ELLIPSIS, ON, typeCondition, selectionSet)
..directives.addAll(directives); ..directives.addAll(directives);
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing selection set in inline fragment.', 'Missing selection set in inline fragment.',
directives.isEmpty directives.isEmpty
? typeCondition.span ? typeCondition.span
@ -174,13 +174,13 @@ class Parser {
return null; return null;
} }
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing type condition after "on" in inline fragment.', 'Missing type condition after "on" in inline fragment.',
ON.span)); ON.span));
return null; return null;
} }
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing "on" after "..." in inline fragment.', ELLIPSIS.span)); 'Missing "on" after "..." in inline fragment.', ELLIPSIS.span));
return null; return null;
} }
@ -202,10 +202,10 @@ class Parser {
eatCommas(); eatCommas();
if (next(TokenType.RBRACE)) if (next(TokenType.RBRACE))
return new SelectionSetContext(LBRACE, current) return SelectionSetContext(LBRACE, current)
..selections.addAll(selections); ..selections.addAll(selections);
else { else {
errors.add(new SyntaxError('Missing "}" after selection set.', errors.add(SyntaxError('Missing "}" after selection set.',
selections.isEmpty ? LBRACE.span : selections.last.span)); selections.isEmpty ? LBRACE.span : selections.last.span));
return null; return null;
} }
@ -215,13 +215,13 @@ class Parser {
SelectionContext parseSelection() { SelectionContext parseSelection() {
var field = parseField(); var field = parseField();
if (field != null) return new SelectionContext(field); if (field != null) return SelectionContext(field);
var fragmentSpread = parseFragmentSpread(); var fragmentSpread = parseFragmentSpread();
if (fragmentSpread != null) if (fragmentSpread != null)
return new SelectionContext(null, fragmentSpread); return SelectionContext(null, fragmentSpread);
var inlineFragment = parseInlineFragment(); var inlineFragment = parseInlineFragment();
if (inlineFragment != null) if (inlineFragment != null)
return new SelectionContext(null, null, inlineFragment); return SelectionContext(null, null, inlineFragment);
else else
return null; return null;
} }
@ -232,7 +232,7 @@ class Parser {
var args = parseArguments(); var args = parseArguments();
var directives = parseDirectives(); var directives = parseDirectives();
var selectionSet = parseSelectionSet(); var selectionSet = parseSelectionSet();
return new FieldContext(fieldName, selectionSet) return FieldContext(fieldName, selectionSet)
..arguments.addAll(args ?? <ArgumentContext>[]) ..arguments.addAll(args ?? <ArgumentContext>[])
..directives.addAll(directives); ..directives.addAll(directives);
} else } else
@ -245,15 +245,15 @@ class Parser {
if (next(TokenType.COLON)) { if (next(TokenType.COLON)) {
var COLON = current; var COLON = current;
if (next(TokenType.NAME)) if (next(TokenType.NAME))
return new FieldNameContext( return FieldNameContext(
null, new AliasContext(NAME1, COLON, current)); null, AliasContext(NAME1, COLON, current));
else { else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing name after colon in alias.', COLON.span)); 'Missing name after colon in alias.', COLON.span));
return null; return null;
} }
} else } else
return new FieldNameContext(NAME1); return FieldNameContext(NAME1);
} else } else
return null; return null;
} }
@ -271,10 +271,10 @@ class Parser {
} }
if (next(TokenType.RPAREN)) if (next(TokenType.RPAREN))
return new VariableDefinitionsContext(LPAREN, current) return VariableDefinitionsContext(LPAREN, current)
..variableDefinitions.addAll(defs); ..variableDefinitions.addAll(defs);
else { else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing ")" after variable definitions.', LPAREN.span)); 'Missing ")" after variable definitions.', LPAREN.span));
return null; return null;
} }
@ -290,15 +290,15 @@ class Parser {
var type = parseType(); var type = parseType();
if (type != null) { if (type != null) {
var defaultValue = parseDefaultValue(); var defaultValue = parseDefaultValue();
return new VariableDefinitionContext( return VariableDefinitionContext(
variable, COLON, type, defaultValue); variable, COLON, type, defaultValue);
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing type in variable definition.', COLON.span)); 'Missing type in variable definition.', COLON.span));
return null; return null;
} }
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing ":" in variable definition.', variable.span)); 'Missing ":" in variable definition.', variable.span));
return null; return null;
} }
@ -309,11 +309,11 @@ class Parser {
TypeContext parseType() { TypeContext parseType() {
var name = parseTypeName(); var name = parseTypeName();
if (name != null) { if (name != null) {
return new TypeContext(name, null, maybe(TokenType.EXCLAMATION)); return TypeContext(name, null, maybe(TokenType.EXCLAMATION));
} else { } else {
var listType = parseListType(); var listType = parseListType();
if (listType != null) { if (listType != null) {
return new TypeContext(null, listType, maybe(TokenType.EXCLAMATION)); return TypeContext(null, listType, maybe(TokenType.EXCLAMATION));
} else } else
return null; return null;
} }
@ -325,13 +325,13 @@ class Parser {
var type = parseType(); var type = parseType();
if (type != null) { if (type != null) {
if (next(TokenType.RBRACKET)) { if (next(TokenType.RBRACKET)) {
return new ListTypeContext(LBRACKET, type, current); return ListTypeContext(LBRACKET, type, current);
} else { } else {
errors.add(new SyntaxError('Missing "]" in list type.', type.span)); errors.add(SyntaxError('Missing "]" in list type.', type.span));
return null; return null;
} }
} else { } else {
errors.add(new SyntaxError('Missing type after "[".', LBRACKET.span)); errors.add(SyntaxError('Missing type after "[".', LBRACKET.span));
return null; return null;
} }
} else } else
@ -359,10 +359,10 @@ class Parser {
var COLON = current; var COLON = current;
var val = parseInputValue(); var val = parseInputValue();
if (val != null) if (val != null)
return new DirectiveContext( return DirectiveContext(
ARROBA, NAME, COLON, null, null, null, val); ARROBA, NAME, COLON, null, null, null, val);
else { else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing value or variable in directive after colon.', 'Missing value or variable in directive after colon.',
COLON.span)); COLON.span));
return null; return null;
@ -372,22 +372,22 @@ class Parser {
var arg = parseArgument(); var arg = parseArgument();
if (arg != null) { if (arg != null) {
if (next(TokenType.RPAREN)) { if (next(TokenType.RPAREN)) {
return new DirectiveContext( return DirectiveContext(
ARROBA, NAME, null, LPAREN, current, arg, null); ARROBA, NAME, null, LPAREN, current, arg, null);
} else { } else {
errors.add(new SyntaxError('Missing \')\'', arg.value.span)); errors.add(SyntaxError('Missing \')\'', arg.value.span));
return null; return null;
} }
} else { } else {
errors.add( errors.add(
new SyntaxError('Missing argument in directive.', LPAREN.span)); SyntaxError('Missing argument in directive.', LPAREN.span));
return null; return null;
} }
} else } else
return new DirectiveContext( return DirectiveContext(
ARROBA, NAME, null, null, null, null, null); ARROBA, NAME, null, null, null, null, null);
} else { } else {
errors.add(new SyntaxError('Missing name for directive.', ARROBA.span)); errors.add(SyntaxError('Missing name for directive.', ARROBA.span));
return null; return null;
} }
} else } else
@ -410,7 +410,7 @@ class Parser {
return out; return out;
else { else {
errors errors
.add(new SyntaxError('Missing ")" in argument list.', LPAREN.span)); .add(SyntaxError('Missing ")" in argument list.', LPAREN.span));
return null; return null;
} }
} else } else
@ -424,14 +424,14 @@ class Parser {
var COLON = current; var COLON = current;
var val = parseInputValue(); var val = parseInputValue();
if (val != null) if (val != null)
return new ArgumentContext(NAME, COLON, val); return ArgumentContext(NAME, COLON, val);
else { else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing value or variable in argument.', COLON.span)); 'Missing value or variable in argument.', COLON.span));
return null; return null;
} }
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing colon after name in argument.', NAME.span)); 'Missing colon after name in argument.', NAME.span));
return null; return null;
} }
@ -447,9 +447,9 @@ class Parser {
if (next(TokenType.DOLLAR)) { if (next(TokenType.DOLLAR)) {
var DOLLAR = current; var DOLLAR = current;
if (next(TokenType.NAME)) if (next(TokenType.NAME))
return new VariableContext(DOLLAR, current); return VariableContext(DOLLAR, current);
else { else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing name for variable; found a lone "\$" instead.', 'Missing name for variable; found a lone "\$" instead.',
DOLLAR.span)); DOLLAR.span));
return null; return null;
@ -463,10 +463,10 @@ class Parser {
var EQUALS = current; var EQUALS = current;
var value = parseInputValue(); var value = parseInputValue();
if (value != null) { if (value != null) {
return new DefaultValueContext(EQUALS, value); return DefaultValueContext(EQUALS, value);
} else { } else {
errors errors
.add(new SyntaxError('Missing value after "=" sign.', EQUALS.span)); .add(SyntaxError('Missing value after "=" sign.', EQUALS.span));
return null; return null;
} }
} else } else
@ -476,14 +476,14 @@ class Parser {
TypeConditionContext parseTypeCondition() { TypeConditionContext parseTypeCondition() {
var name = parseTypeName(); var name = parseTypeName();
if (name != null) if (name != null)
return new TypeConditionContext(name); return TypeConditionContext(name);
else else
return null; return null;
} }
TypeNameContext parseTypeName() { TypeNameContext parseTypeName() {
if (next(TokenType.NAME)) { if (next(TokenType.NAME)) {
return new TypeNameContext(current); return TypeNameContext(current);
} else } else
return null; return null;
} }
@ -504,24 +504,24 @@ class Parser {
} }
StringValueContext parseStringValue() => next(TokenType.STRING) StringValueContext parseStringValue() => next(TokenType.STRING)
? new StringValueContext(current) ? StringValueContext(current)
: (next(TokenType.BLOCK_STRING) : (next(TokenType.BLOCK_STRING)
? new StringValueContext(current, isBlockString: true) ? StringValueContext(current, isBlockString: true)
: null); : null);
NumberValueContext parseNumberValue() => NumberValueContext parseNumberValue() =>
next(TokenType.NUMBER) ? new NumberValueContext(current) : null; next(TokenType.NUMBER) ? NumberValueContext(current) : null;
BooleanValueContext parseBooleanValue() => BooleanValueContext parseBooleanValue() =>
(nextName('true') || nextName('false')) (nextName('true') || nextName('false'))
? new BooleanValueContext(current) ? BooleanValueContext(current)
: null; : null;
EnumValueContext parseEnumValue() => EnumValueContext parseEnumValue() =>
next(TokenType.NAME) ? new EnumValueContext(current) : null; next(TokenType.NAME) ? EnumValueContext(current) : null;
NullValueContext parseNullValue() => NullValueContext parseNullValue() =>
nextName('null') ? new NullValueContext(current) : null; nextName('null') ? NullValueContext(current) : null;
ListValueContext parseListValue() { ListValueContext parseListValue() {
if (next(TokenType.LBRACKET)) { if (next(TokenType.LBRACKET)) {
@ -539,9 +539,9 @@ class Parser {
eatCommas(); eatCommas();
if (next(TokenType.RBRACKET)) { if (next(TokenType.RBRACKET)) {
return new ListValueContext(LBRACKET, current)..values.addAll(values); return ListValueContext(LBRACKET, current)..values.addAll(values);
} else { } else {
errors.add(new SyntaxError('Unterminated list literal.', lastSpan)); errors.add(SyntaxError('Unterminated list literal.', lastSpan));
return null; return null;
} }
} else } else
@ -565,9 +565,9 @@ class Parser {
eatCommas(); eatCommas();
if (next(TokenType.RBRACE)) { if (next(TokenType.RBRACE)) {
return new ObjectValueContext(LBRACE, fields, current); return ObjectValueContext(LBRACE, fields, current);
} else { } else {
errors.add(new SyntaxError('Unterminated object literal.', lastSpan)); errors.add(SyntaxError('Unterminated object literal.', lastSpan));
return null; return null;
} }
} else { } else {
@ -584,13 +584,13 @@ class Parser {
var value = parseInputValue(); var value = parseInputValue();
if (value != null) { if (value != null) {
return new ObjectFieldContext(NAME, COLON, value); return ObjectFieldContext(NAME, COLON, value);
} else { } else {
errors.add(new SyntaxError('Missing value after ":".', COLON.span)); errors.add(SyntaxError('Missing value after ":".', COLON.span));
return null; return null;
} }
} else { } else {
errors.add(new SyntaxError( errors.add(SyntaxError(
'Missing ":" after name "${NAME.span.text}".', NAME.span)); 'Missing ":" after name "${NAME.span.text}".', NAME.span));
return null; return null;
} }

View file

@ -32,10 +32,10 @@ ArgumentContext parseArgument(String text) => parse(text).parseArgument();
List<ArgumentContext> parseArgumentList(String text) => List<ArgumentContext> parseArgumentList(String text) =>
parse(text).parseArguments(); parse(text).parseArguments();
Matcher isArgument(String name, value) => new _IsArgument(name, value); Matcher isArgument(String name, value) => _IsArgument(name, value);
Matcher isArgumentList(List<Matcher> arguments) => Matcher isArgumentList(List<Matcher> arguments) =>
new _IsArgumentList(arguments); _IsArgumentList(arguments);
class _IsArgument extends Matcher { class _IsArgument extends Matcher {
final String name; final String name;

View file

@ -1,3 +1,3 @@
import 'package:graphql_parser/graphql_parser.dart'; import 'package:graphql_parser/graphql_parser.dart';
Parser parse(String text) => new Parser(scan(text)); Parser parse(String text) => Parser(scan(text));

View file

@ -37,11 +37,11 @@ main() {
DirectiveContext parseDirective(String text) => parse(text).parseDirective(); DirectiveContext parseDirective(String text) => parse(text).parseDirective();
Matcher isDirective(String name, {Matcher valueOrVariable, Matcher argument}) => Matcher isDirective(String name, {Matcher valueOrVariable, Matcher argument}) =>
new _IsDirective(name, _IsDirective(name,
valueOrVariable: valueOrVariable, argument: argument); valueOrVariable: valueOrVariable, argument: argument);
Matcher isDirectiveList(List<Matcher> directives) => Matcher isDirectiveList(List<Matcher> directives) =>
new _IsDirectiveList(directives); _IsDirectiveList(directives);
class _IsDirective extends Matcher { class _IsDirective extends Matcher {
final String name; final String name;

View file

@ -86,10 +86,10 @@ Matcher isField(
Matcher arguments, Matcher arguments,
Matcher directives, Matcher directives,
Matcher selectionSet}) => Matcher selectionSet}) =>
new _IsField(fieldName, arguments, directives, selectionSet); _IsField(fieldName, arguments, directives, selectionSet);
Matcher isFieldName(String name, {String alias}) => Matcher isFieldName(String name, {String alias}) =>
new _IsFieldName(name, alias); _IsFieldName(name, alias);
class _IsField extends Matcher { class _IsField extends Matcher {
final Matcher fieldName, arguments, directives, selectionSet; final Matcher fieldName, arguments, directives, selectionSet;

View file

@ -25,7 +25,7 @@ FragmentSpreadContext parseFragmentSpread(String text) =>
parse(text).parseFragmentSpread(); parse(text).parseFragmentSpread();
Matcher isFragmentSpread(String name, {Matcher directives}) => Matcher isFragmentSpread(String name, {Matcher directives}) =>
new _IsFragmentSpread(name, directives); _IsFragmentSpread(name, directives);
class _IsFragmentSpread extends Matcher { class _IsFragmentSpread extends Matcher {
final String name; final String name;

View file

@ -47,7 +47,7 @@ InlineFragmentContext parseInlineFragment(String text) =>
Matcher isInlineFragment(String name, Matcher isInlineFragment(String name,
{Matcher directives, Matcher selectionSet}) => {Matcher directives, Matcher selectionSet}) =>
new _IsInlineFragment(name, directives, selectionSet); _IsInlineFragment(name, directives, selectionSet);
class _IsInlineFragment extends Matcher { class _IsInlineFragment extends Matcher {
final String name; final String name;

View file

@ -56,7 +56,7 @@ SelectionSetContext parseSelectionSet(String text) =>
parse(text).parseSelectionSet(); parse(text).parseSelectionSet();
Matcher isSelectionSet(List<Matcher> selections) => Matcher isSelectionSet(List<Matcher> selections) =>
new _IsSelectionSet(selections); _IsSelectionSet(selections);
class _IsSelectionSet extends Matcher { class _IsSelectionSet extends Matcher {
final List<Matcher> selections; final List<Matcher> selections;

View file

@ -49,10 +49,10 @@ main() {
TypeContext parseType(String text) => parse(text).parseType(); TypeContext parseType(String text) => parse(text).parseType();
Matcher isListType(Matcher innerType, {bool isNullable}) => Matcher isListType(Matcher innerType, {bool isNullable}) =>
new _IsListType(innerType, isNullable: isNullable != false); _IsListType(innerType, isNullable: isNullable != false);
Matcher isType(String name, {bool isNullable}) => Matcher isType(String name, {bool isNullable}) =>
new _IsType(name, nonNull: isNullable != true); _IsType(name, nonNull: isNullable != true);
class _IsListType extends Matcher { class _IsListType extends Matcher {
final Matcher innerType; final Matcher innerType;

View file

@ -74,7 +74,7 @@ main() {
InputValueContext parseValue(String text) => parse(text).parseInputValue(); InputValueContext parseValue(String text) => parse(text).parseInputValue();
Matcher isValue(value) => new _IsValue(value); Matcher isValue(value) => _IsValue(value);
class _IsValue extends Matcher { class _IsValue extends Matcher {
final value; final value;

View file

@ -42,7 +42,7 @@ VariableDefinitionContext parseVariableDefinition(String text) =>
Matcher isVariableDefinition(String name, Matcher isVariableDefinition(String name,
{Matcher type, Matcher defaultValue}) => {Matcher type, Matcher defaultValue}) =>
new _IsVariableDefinition(name, type, defaultValue); _IsVariableDefinition(name, type, defaultValue);
class _IsVariableDefinition extends Matcher { class _IsVariableDefinition extends Matcher {
final String name; final String name;

View file

@ -22,7 +22,7 @@ main() {
}); });
} }
Matcher isVariable(String name) => new _IsVariable(name); Matcher isVariable(String name) => _IsVariable(name);
class _IsVariable extends Matcher { class _IsVariable extends Matcher {
final String name; final String name;