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

Unified Diff: pkg/analyzer/lib/src/dart/sdk/sdk.dart

Issue 2967503002: Fix the resolution of uri-based part-of directives in the SDK (issue 29598) (Closed)
Patch Set: Created 3 years, 6 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
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 {
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | pkg/analyzer/test/src/context/source_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698