diff --git a/graphql_parser/example/example.dart b/graphql_parser/example/example.dart index 34566298..5a3f1be4 100644 --- a/graphql_parser/example/example.dart +++ b/graphql_parser/example/example.dart @@ -19,7 +19,7 @@ main() { var projectField = operation.selectionSet.selections.first.field; print(projectField.fieldName.name); // project print(projectField.arguments.first.name); // name - print(projectField.arguments.first.valueOrVariable.value.value); // GraphQL + print(projectField.arguments.first.value); // GraphQL var taglineField = projectField.selectionSet.selections.first.field; print(taglineField.fieldName.name); // tagline diff --git a/graphql_parser/lib/src/language/ast/array_value.dart b/graphql_parser/lib/src/language/ast/array_value.dart index 63633b5a..ff6ed44b 100644 --- a/graphql_parser/lib/src/language/ast/array_value.dart +++ b/graphql_parser/lib/src/language/ast/array_value.dart @@ -1,6 +1,7 @@ import 'package:source_span/source_span.dart'; import '../token.dart'; -import 'value.dart'; +import 'constant.dart'; +import 'input_value.dart'; class ListValueContext extends ValueContext { final Token LBRACKET, RBRACKET; diff --git a/graphql_parser/lib/src/language/ast/input_value.dart b/graphql_parser/lib/src/language/ast/input_value.dart index 103c07f4..29e703ca 100644 --- a/graphql_parser/lib/src/language/ast/input_value.dart +++ b/graphql_parser/lib/src/language/ast/input_value.dart @@ -1,19 +1,5 @@ -import 'package:source_span/source_span.dart'; -import 'constant.dart'; import 'node.dart'; -import 'variable.dart'; -class InputValueContext extends Node { - final ConstantContext constant; - final VariableContext variable; - - InputValueContext(this.constant, this.variable) { - assert(constant != null || variable != null); - } - - @override - FileSpan get span => constant?.span ?? variable.span; - - Object computeValue(Map variables) => - constant?.computeValue(variables) ?? variable?.computeValue(variables); +abstract class InputValueContext extends Node { + T computeValue(Map variables); }