| OLD | NEW |
| 1 import 'dart:io' as io; | 1 import 'dart:io' as io; |
| 2 | 2 |
| 3 import 'package:analyzer/dart/element/element.dart'; | 3 import 'package:analyzer/dart/element/element.dart'; |
| 4 import 'package:analyzer/src/context/cache.dart'; | 4 import 'package:analyzer/src/context/cache.dart'; |
| 5 import 'package:analyzer/src/context/context.dart'; | 5 import 'package:analyzer/src/context/context.dart'; |
| 6 import 'package:analyzer/src/generated/engine.dart'; | 6 import 'package:analyzer/src/generated/engine.dart'; |
| 7 import 'package:analyzer/src/generated/java_io.dart'; | 7 import 'package:analyzer/src/generated/java_io.dart'; |
| 8 import 'package:analyzer/src/generated/resolver.dart'; | 8 import 'package:analyzer/src/generated/resolver.dart'; |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:analyzer/src/generated/source_io.dart'; | 10 import 'package:analyzer/src/generated/source_io.dart'; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 /** | 186 /** |
| 187 * Map from the URI of a library to the summary path that contained it. | 187 * Map from the URI of a library to the summary path that contained it. |
| 188 */ | 188 */ |
| 189 final Map<String, String> uriToSummaryPath = <String, String>{}; | 189 final Map<String, String> uriToSummaryPath = <String, String>{}; |
| 190 | 190 |
| 191 SummaryDataStore(Iterable<String> summaryPaths) { | 191 SummaryDataStore(Iterable<String> summaryPaths) { |
| 192 summaryPaths.forEach(_fillMaps); | 192 summaryPaths.forEach(_fillMaps); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void _fillMaps(String path) { | 195 /** |
| 196 io.File file = new io.File(path); | 196 * Add the given [bundle] loaded from the file with the given [path]. |
| 197 List<int> buffer = file.readAsBytesSync(); | 197 */ |
| 198 PackageBundle bundle = new PackageBundle.fromBuffer(buffer); | 198 void addBundle(String path, PackageBundle bundle) { |
| 199 for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) { | 199 for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) { |
| 200 String uri = bundle.unlinkedUnitUris[i]; | 200 String uri = bundle.unlinkedUnitUris[i]; |
| 201 uriToSummaryPath[uri] = path; | 201 uriToSummaryPath[uri] = path; |
| 202 unlinkedMap[uri] = bundle.unlinkedUnits[i]; | 202 unlinkedMap[uri] = bundle.unlinkedUnits[i]; |
| 203 } | 203 } |
| 204 for (int i = 0; i < bundle.linkedLibraryUris.length; i++) { | 204 for (int i = 0; i < bundle.linkedLibraryUris.length; i++) { |
| 205 String uri = bundle.linkedLibraryUris[i]; | 205 String uri = bundle.linkedLibraryUris[i]; |
| 206 linkedMap[uri] = bundle.linkedLibraries[i]; | 206 linkedMap[uri] = bundle.linkedLibraries[i]; |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 |
| 210 void _fillMaps(String path) { |
| 211 io.File file = new io.File(path); |
| 212 List<int> buffer = file.readAsBytesSync(); |
| 213 PackageBundle bundle = new PackageBundle.fromBuffer(buffer); |
| 214 addBundle(path, bundle); |
| 215 } |
| 209 } | 216 } |
| 210 | 217 |
| 211 /** | 218 /** |
| 212 * A concrete resynthesizer that serves summaries from given file paths. | 219 * A concrete resynthesizer that serves summaries from given file paths. |
| 213 */ | 220 */ |
| 214 class _FileBasedSummaryResynthesizer extends SummaryResynthesizer { | 221 class _FileBasedSummaryResynthesizer extends SummaryResynthesizer { |
| 215 final SummaryDataStore _dataStore; | 222 final SummaryDataStore _dataStore; |
| 216 | 223 |
| 217 _FileBasedSummaryResynthesizer( | 224 _FileBasedSummaryResynthesizer( |
| 218 SummaryResynthesizer parent, | 225 SummaryResynthesizer parent, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 246 * also provides [summaryPath]. | 253 * also provides [summaryPath]. |
| 247 */ | 254 */ |
| 248 class _InSummaryFallbackSource extends FileBasedSource | 255 class _InSummaryFallbackSource extends FileBasedSource |
| 249 implements InSummarySource { | 256 implements InSummarySource { |
| 250 @override | 257 @override |
| 251 final String summaryPath; | 258 final String summaryPath; |
| 252 | 259 |
| 253 _InSummaryFallbackSource(JavaFile file, Uri uri, this.summaryPath) | 260 _InSummaryFallbackSource(JavaFile file, Uri uri, this.summaryPath) |
| 254 : super(file, uri); | 261 : super(file, uri); |
| 255 } | 262 } |
| OLD | NEW |