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

Unified Diff: dart/pkg/compiler/lib/src/library_loader.dart

Issue 803543002: Resolve libraries against their canonical URI. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r42358. Created 6 years 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 | « dart/pkg/compiler/lib/src/apiimpl.dart ('k') | dart/pkg/compiler/lib/src/scanner/scanner_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/compiler/lib/src/library_loader.dart
diff --git a/dart/pkg/compiler/lib/src/library_loader.dart b/dart/pkg/compiler/lib/src/library_loader.dart
index 8debbe7c92c3ddc79c02608ea5041816dfd72286..25b5288781eff6ca010471d8278addac13d6c346 100644
--- a/dart/pkg/compiler/lib/src/library_loader.dart
+++ b/dart/pkg/compiler/lib/src/library_loader.dart
@@ -435,23 +435,8 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
});
}
- /// True if the uris are pointing to a library that is shared between dart2js
- /// and the core libraries. By construction they must be imported into the
- /// runtime, and, at the same time, into dart2js. This can lead to
- /// duplicated imports, like in the docgen.
- // TODO(johnniwinther): is this necessary, or should we change docgen not
- // to include both libraries (compiler and lib) at the same time?
- bool _isSharedDart2jsLibrary(Uri uri1, Uri uri2) {
- bool inJsLibShared(Uri uri) {
- List<String> segments = uri.pathSegments;
- if (segments.length < 3) return false;
- if (segments[segments.length - 2] != 'shared') return false;
- return (segments[segments.length - 3] == 'js_lib');
- }
- return inJsLibShared(uri1) && inJsLibShared(uri2);
- }
-
void checkDuplicatedLibraryName(LibraryElement library) {
+ if (library.isInternalLibrary) return;
Uri resourceUri = library.entryCompilationUnit.script.resourceUri;
LibraryName tag = library.libraryTag;
LibraryElement existing =
@@ -476,8 +461,7 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
} else if (tag != null) {
String name = library.getLibraryOrScriptName();
existing = libraryNames.putIfAbsent(name, () => library);
- if (!identical(existing, library) &&
- !_isSharedDart2jsLibrary(resourceUri, existing.canonicalUri)) {
+ if (!identical(existing, library)) {
compiler.withCurrentElement(library, () {
compiler.reportWarning(tag.name,
MessageKind.DUPLICATED_LIBRARY_NAME,
@@ -525,7 +509,7 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
Future registerLibraryFromTag(LibraryDependencyHandler handler,
LibraryElement library,
LibraryDependency tag) {
- Uri base = library.entryCompilationUnit.script.readableUri;
+ Uri base = library.canonicalUri;
Uri resolvedUri = base.resolve(tag.uri.dartString.slowToString());
return createLibrary(handler, library, resolvedUri, tag.uri)
.then((LibraryElement loadedLibrary) {
« no previous file with comments | « dart/pkg/compiler/lib/src/apiimpl.dart ('k') | dart/pkg/compiler/lib/src/scanner/scanner_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698