Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: pkg/analyzer/lib/src/generated/source_io.dart

Issue 670263005: Issue 21451. Fix for 'Add import' Quick Fix in case when package roots is in use. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/source_io.dart
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index 60740c1050488ebc07cb1b503e83e3e9df49ef8c..ff584e487190fec29eb1db676b7332dfaf272543 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -399,20 +399,18 @@ class PackageUriResolver extends UriResolver {
@override
Uri restoreAbsolute(Source source) {
- if (source is FileBasedSource) {
- String sourcePath = source.file.getPath();
- for (JavaFile packagesDirectory in _packagesDirectories) {
- List<JavaFile> pkgFolders = packagesDirectory.listFiles();
- if (pkgFolders != null) {
- for (JavaFile pkgFolder in pkgFolders) {
- try {
- String pkgCanonicalPath = pkgFolder.getCanonicalPath();
- if (sourcePath.startsWith(pkgCanonicalPath)) {
- String relPath = sourcePath.substring(pkgCanonicalPath.length);
- return parseUriWithException("$PACKAGE_SCHEME:${pkgFolder.getName()}$relPath");
- }
- } catch (e) {
+ String sourcePath = source.fullName;
+ for (JavaFile packagesDirectory in _packagesDirectories) {
+ List<JavaFile> pkgFolders = packagesDirectory.listFiles();
+ if (pkgFolders != null) {
+ for (JavaFile pkgFolder in pkgFolders) {
+ try {
+ String pkgCanonicalPath = pkgFolder.getCanonicalPath();
+ if (sourcePath.startsWith(pkgCanonicalPath)) {
+ String relPath = sourcePath.substring(pkgCanonicalPath.length);
+ return parseUriWithException("$PACKAGE_SCHEME:${pkgFolder.getName()}$relPath");
}
+ } catch (e) {
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698