Chromium Code Reviews| Index: pkg/analyzer/lib/src/dart/sdk/sdk.dart |
| diff --git a/pkg/analyzer/lib/src/dart/sdk/sdk.dart b/pkg/analyzer/lib/src/dart/sdk/sdk.dart |
| index a6c49083fdeb69ed4bd6bf51aa7daa3fbd7d398a..cfed575fb9872503f05c0ce444b759fa6a5c8946 100644 |
| --- a/pkg/analyzer/lib/src/dart/sdk/sdk.dart |
| +++ b/pkg/analyzer/lib/src/dart/sdk/sdk.dart |
| @@ -651,7 +651,13 @@ class FolderBasedDartSdk extends AbstractDartSdk { |
| try { |
| File file = libraryDirectory.getChildAssumingFile(library.path); |
| if (!relativePath.isEmpty) { |
| - file = file.parent.getChildAssumingFile(relativePath); |
| + File relativeFile = file.parent.getChildAssumingFile(relativePath); |
| + if (relativeFile.path == file.path) { |
| + // The relative file is the library, so return a Source for the |
| + // library rather than the part format. |
| + return file.createSource(Uri.parse(library.shortName)); |
| + } |
| + file = relativeFile; |
| } |
| return file.createSource(Uri.parse(dartUri)); |
|
scheglov
2017/06/29 20:19:24
Maybe extract the URI into a variable and update i
Brian Wilkerson
2017/06/29 20:47:15
I don't know what problem that would solve.
scheglov
2017/06/29 20:50:38
Well, it's not a problem, just avoid duplication o
|
| } on FormatException { |