From bf2ef30ade9b1f84f4de05ae1dfd978875c42392 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 7 Aug 2019 21:48:12 -0400 Subject: [PATCH] Update misc_values --- .../lib/src/language/ast/misc_value.dart | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/graphql_parser/lib/src/language/ast/misc_value.dart b/graphql_parser/lib/src/language/ast/misc_value.dart index d7f3a2ce..0aa1facb 100644 --- a/graphql_parser/lib/src/language/ast/misc_value.dart +++ b/graphql_parser/lib/src/language/ast/misc_value.dart @@ -1,10 +1,9 @@ import 'package:source_span/source_span.dart'; - import '../token.dart'; +import 'input_value.dart'; import 'node.dart'; -import 'value.dart'; -class NullValueContext extends ValueContext { +class NullValueContext extends InputValueContext { final Token NULL; NullValueContext(this.NULL); @@ -13,10 +12,10 @@ class NullValueContext extends ValueContext { FileSpan get span => NULL.span; @override - Null get value => null; + Null computeValue(Map variables) => null; } -class EnumValueContext extends ValueContext { +class EnumValueContext extends InputValueContext { final Token NAME; EnumValueContext(this.NAME); @@ -25,10 +24,10 @@ class EnumValueContext extends ValueContext { FileSpan get span => NAME.span; @override - String get value => NAME.span.text; + String computeValue(Map variables) => NAME.span.text; } -class ObjectValueContext extends ValueContext> { +class ObjectValueContext extends InputValueContext> { final Token LBRACE; final List fields; final Token RBRACE; @@ -47,13 +46,13 @@ class ObjectValueContext extends ValueContext> { } @override - Map get value { + Map computeValue(Map variables) { if (fields.isEmpty) { return {}; } else { return fields.fold>({}, (map, field) { - return map..[field.NAME.text] = field.value.value; + return map..[field.NAME.text] = field.value.computeValue(variables); }); } } @@ -62,7 +61,7 @@ class ObjectValueContext extends ValueContext> { class ObjectFieldContext extends Node { final Token NAME; final Token COLON; - final ValueContext value; + final InputValueContext value; ObjectFieldContext(this.NAME, this.COLON, this.value);