Index: pkg/compiler/lib/src/elements/modelx.dart |
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart |
index 5c3615125672fe000ff13ef9cce687c9fa300c3b..5bfd56f46cc1c1ec9bfc4358a11b39ea728998ce 100644 |
--- a/pkg/compiler/lib/src/elements/modelx.dart |
+++ b/pkg/compiler/lib/src/elements/modelx.dart |
@@ -767,6 +767,20 @@ class CompilationUnitElementX extends ElementX |
} |
partTag = tag; |
LibraryName libraryTag = library.libraryTag; |
+ |
+ Expression libraryReference = tag.name; |
+ if (libraryReference is LiteralString) { |
+ // Name is a URI. Resolve and compare to library's URI. |
+ String content = libraryReference.dartString.slowToString(); |
+ Uri uri = this.script.readableUri.resolve(content); |
+ Uri expectedUri = library.canonicalUri; |
+ if (uri != expectedUri) { |
+ // Consider finding a relative URI reference for the error message. |
+ reporter.reportWarningMessage(tag.name, |
+ MessageKind.LIBRARY_URI_MISMATCH, {'libraryUri': expectedUri}); |
+ } |
+ return; |
+ } |
String actualName = tag.name.toString(); |
if (libraryTag != null) { |
String expectedName = libraryTag.name.toString(); |