Index: pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart |
diff --git a/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart b/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..22e8b33b8d0c04fd5d05e01dfea1d4814370cf8f |
--- /dev/null |
+++ b/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart |
@@ -0,0 +1,54 @@ |
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+import 'package:analyzer/dart/analysis/results.dart'; |
+import 'package:analyzer/file_system/file_system.dart'; |
+import 'package:analyzer/src/generated/source.dart'; |
+import 'package:analyzer_plugin/protocol/protocol_common.dart' |
+ hide AnalysisError; |
+import 'package:analyzer_plugin/utilities/folding/folding.dart'; |
+ |
+/** |
+ * A concrete implementation of [DartFoldingRequest]. |
+ */ |
+class DartFoldingRequestImpl implements DartFoldingRequest { |
+ @override |
+ final ResourceProvider resourceProvider; |
+ |
+ @override |
+ final ResolveResult result; |
+ |
+ /** |
+ * Initialize a newly create request with the given data. |
+ */ |
+ DartFoldingRequestImpl(this.resourceProvider, this.result); |
+ |
+ @override |
+ String get path => result.path; |
+} |
+ |
+/** |
+ * A concrete implementation of [FoldingCollector]. |
+ */ |
+class FoldingCollectorImpl implements FoldingCollector { |
+ /** |
+ * The list of folding regions that have been collected. |
+ */ |
+ List<FoldingRegion> regions = <FoldingRegion>[]; |
+ |
+ /** |
+ * Initialize a newly created collector. |
+ */ |
+ FoldingCollectorImpl(); |
+ |
+ @override |
+ void addRange(SourceRange range, FoldingKind kind) { |
+ addRegion(range.offset, range.length, kind); |
+ } |
+ |
+ @override |
+ void addRegion(int offset, int length, FoldingKind kind) { |
+ regions.add(new FoldingRegion(kind, offset, length)); |
+ } |
+} |