Remove input value context

This commit is contained in:
Tobe O 2019-08-07 21:43:24 -04:00
parent deb6673654
commit ae50e0dae7
3 changed files with 5 additions and 18 deletions

View file

@ -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

View file

@ -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;

View file

@ -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<String, dynamic> variables) =>
constant?.computeValue(variables) ?? variable?.computeValue(variables);
abstract class InputValueContext<T> extends Node {
T computeValue(Map<String, dynamic> variables);
}