platform/graphql_parser/lib/src/language/ast/document.dart

16 lines
365 B
Dart
Raw Normal View History

2017-07-05 22:44:13 +00:00
import 'package:source_span/source_span.dart';
2017-01-22 23:15:53 +00:00
import 'definition.dart';
import 'node.dart';
class DocumentContext extends Node {
final List<DefinitionContext> definitions = [];
@override
2017-07-05 22:44:13 +00:00
FileSpan get span {
2017-01-22 23:15:53 +00:00
if (definitions.isEmpty) return null;
2017-07-04 17:32:52 +00:00
return definitions
2017-07-05 22:44:13 +00:00
.map<FileSpan>((d) => d.span)
.reduce((a, b) => a.expand(b));
2017-01-22 23:15:53 +00:00
}
}