| 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/file_system/file_system.dart'; | 4 import 'package:analyzer/file_system/file_system.dart'; |
| 5 import 'package:analyzer/src/context/cache.dart'; | 5 import 'package:analyzer/src/context/cache.dart'; |
| 6 import 'package:analyzer/src/context/context.dart'; | 6 import 'package:analyzer/src/context/context.dart'; |
| 7 import 'package:analyzer/src/dart/element/element.dart'; | 7 import 'package:analyzer/src/dart/element/element.dart'; |
| 8 import 'package:analyzer/src/generated/engine.dart'; | 8 import 'package:analyzer/src/generated/engine.dart'; |
| 9 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; | 9 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 */ | 405 */ |
| 406 void addUnlinkedUnit(String uri, UnlinkedUnit unlinkedUnit) { | 406 void addUnlinkedUnit(String uri, UnlinkedUnit unlinkedUnit) { |
| 407 unlinkedMap[uri] = unlinkedUnit; | 407 unlinkedMap[uri] = unlinkedUnit; |
| 408 } | 408 } |
| 409 | 409 |
| 410 /** | 410 /** |
| 411 * Return a list of absolute URIs of the libraries that contain the unit with | 411 * Return a list of absolute URIs of the libraries that contain the unit with |
| 412 * the given [unitUriString], or `null` if no such library is in the store. | 412 * the given [unitUriString], or `null` if no such library is in the store. |
| 413 */ | 413 */ |
| 414 List<String> getContainingLibraryUris(String unitUriString) { | 414 List<String> getContainingLibraryUris(String unitUriString) { |
| 415 | |
| 416 // The unit is the defining unit of a library. | 415 // The unit is the defining unit of a library. |
| 417 if (linkedMap.containsKey(unitUriString)) { | 416 if (linkedMap.containsKey(unitUriString)) { |
| 418 return <String>[unitUriString]; | 417 return <String>[unitUriString]; |
| 419 } | 418 } |
| 420 // Check every unlinked unit whether it uses [unitUri] as a part. | 419 // Check every unlinked unit whether it uses [unitUri] as a part. |
| 421 List<String> libraryUriStrings = <String>[]; | 420 List<String> libraryUriStrings = <String>[]; |
| 422 unlinkedMap.forEach((unlinkedUnitUriString, unlinkedUnit) { | 421 unlinkedMap.forEach((unlinkedUnitUriString, unlinkedUnit) { |
| 423 Uri libraryUri = Uri.parse(unlinkedUnitUriString); | 422 Uri libraryUri = Uri.parse(unlinkedUnitUriString); |
| 424 for (String partUriString in unlinkedUnit.publicNamespace.parts) { | 423 for (String partUriString in unlinkedUnit.publicNamespace.parts) { |
| 425 Uri partUri = Uri.parse(partUriString); | 424 Uri partUri = Uri.parse(partUriString); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 439 var file = resourceProvider.getFile(path); | 438 var file = resourceProvider.getFile(path); |
| 440 buffer = file.readAsBytesSync(); | 439 buffer = file.readAsBytesSync(); |
| 441 } else { | 440 } else { |
| 442 io.File file = new io.File(path); | 441 io.File file = new io.File(path); |
| 443 buffer = file.readAsBytesSync(); | 442 buffer = file.readAsBytesSync(); |
| 444 } | 443 } |
| 445 PackageBundle bundle = new PackageBundle.fromBuffer(buffer); | 444 PackageBundle bundle = new PackageBundle.fromBuffer(buffer); |
| 446 addBundle(path, bundle); | 445 addBundle(path, bundle); |
| 447 } | 446 } |
| 448 } | 447 } |
| OLD | NEW |