diff --git a/graphql_parser/lib/src/language/ast/constant.dart b/graphql_parser/lib/src/language/ast/constant.dart new file mode 100644 index 00000000..3338a83d --- /dev/null +++ b/graphql_parser/lib/src/language/ast/constant.dart @@ -0,0 +1,11 @@ +import 'node.dart'; + +abstract class ConstantContext extends Node { + T get value; +} + +/// Use [ConstantContext] instead. This class remains solely for backwards compatibility. +@deprecated +abstract class ValueContext extends ConstantContext { + T get value; +} diff --git a/graphql_parser/lib/src/language/ast/input_value.dart b/graphql_parser/lib/src/language/ast/input_value.dart new file mode 100644 index 00000000..238fbec0 --- /dev/null +++ b/graphql_parser/lib/src/language/ast/input_value.dart @@ -0,0 +1,16 @@ +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; +} diff --git a/graphql_parser/lib/src/language/ast/value.dart b/graphql_parser/lib/src/language/ast/value.dart deleted file mode 100644 index edc4e368..00000000 --- a/graphql_parser/lib/src/language/ast/value.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'node.dart'; - -abstract class ValueContext extends Node { - T get value; -} diff --git a/graphql_parser/lib/src/language/ast/value_or_variable.dart b/graphql_parser/lib/src/language/ast/value_or_variable.dart deleted file mode 100644 index 7b28b1e4..00000000 --- a/graphql_parser/lib/src/language/ast/value_or_variable.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'node.dart'; -import 'package:source_span/source_span.dart'; -import 'value.dart'; -import 'variable.dart'; - -class ValueOrVariableContext extends Node { - final ValueContext value; - final VariableContext variable; - - ValueOrVariableContext(this.value, this.variable) { - assert(value != null || variable != null); - } - - @override - FileSpan get span => value?.span ?? variable.span; -}