From ae50e0dae70870bd26c038c9a746ecdf040796b5 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 7 Aug 2019 21:43:24 -0400 Subject: [PATCH] Remove input value context --- graphql_parser/example/example.dart | 2 +- .../lib/src/language/ast/array_value.dart | 3 ++- .../lib/src/language/ast/input_value.dart | 18 ++---------------- 3 files changed, 5 insertions(+), 18 deletions(-) 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); }