OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library services.dependencies.reachable_source_collector; | |
6 | |
7 import 'dart:collection'; | 5 import 'dart:collection'; |
8 | 6 |
9 import 'package:analyzer/src/generated/engine.dart'; | 7 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/source.dart'; | 8 import 'package:analyzer/src/generated/source.dart'; |
11 import 'package:analyzer/task/dart.dart'; | 9 import 'package:analyzer/task/dart.dart'; |
12 | 10 |
13 /// Collects reachable sources. | 11 /// Collects reachable sources. |
14 class ReachableSourceCollector { | 12 class ReachableSourceCollector { |
15 final Map<String, List<String>> _sourceMap = | 13 final Map<String, List<String>> _sourceMap = |
16 new HashMap<String, List<String>>(); | 14 new HashMap<String, List<String>>(); |
(...skipping 26 matching lines...) Expand all Loading... |
43 List<Source> sources = <Source>[]; | 41 List<Source> sources = <Source>[]; |
44 sources.addAll(context.computeResult(source, IMPORTED_LIBRARIES)); | 42 sources.addAll(context.computeResult(source, IMPORTED_LIBRARIES)); |
45 sources.addAll(context.computeResult(source, EXPORTED_LIBRARIES)); | 43 sources.addAll(context.computeResult(source, EXPORTED_LIBRARIES)); |
46 | 44 |
47 _sourceMap[sourceUri] = | 45 _sourceMap[sourceUri] = |
48 sources.map((source) => source.uri.toString()).toList(); | 46 sources.map((source) => source.uri.toString()).toList(); |
49 | 47 |
50 sources.forEach((s) => _addDependencies(s)); | 48 sources.forEach((s) => _addDependencies(s)); |
51 } | 49 } |
52 } | 50 } |
OLD | NEW |