Remove input value context
This commit is contained in:
parent
deb6673654
commit
ae50e0dae7
3 changed files with 5 additions and 18 deletions
|
@ -19,7 +19,7 @@ main() {
|
||||||
var projectField = operation.selectionSet.selections.first.field;
|
var projectField = operation.selectionSet.selections.first.field;
|
||||||
print(projectField.fieldName.name); // project
|
print(projectField.fieldName.name); // project
|
||||||
print(projectField.arguments.first.name); // name
|
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;
|
var taglineField = projectField.selectionSet.selections.first.field;
|
||||||
print(taglineField.fieldName.name); // tagline
|
print(taglineField.fieldName.name); // tagline
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:source_span/source_span.dart';
|
import 'package:source_span/source_span.dart';
|
||||||
import '../token.dart';
|
import '../token.dart';
|
||||||
import 'value.dart';
|
import 'constant.dart';
|
||||||
|
import 'input_value.dart';
|
||||||
|
|
||||||
class ListValueContext extends ValueContext {
|
class ListValueContext extends ValueContext {
|
||||||
final Token LBRACKET, RBRACKET;
|
final Token LBRACKET, RBRACKET;
|
||||||
|
|
|
@ -1,19 +1,5 @@
|
||||||
import 'package:source_span/source_span.dart';
|
|
||||||
import 'constant.dart';
|
|
||||||
import 'node.dart';
|
import 'node.dart';
|
||||||
import 'variable.dart';
|
|
||||||
|
|
||||||
class InputValueContext extends Node {
|
abstract class InputValueContext<T> extends Node {
|
||||||
final ConstantContext constant;
|
T computeValue(Map<String, dynamic> variables);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue