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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 26291005: dart2js: The name of a library without a library declaration is the empty string. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
Index: sdk/lib/_internal/compiler/implementation/elements/modelx.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index e74bd0d389ea59cdd19fae32f579cf3c135b7768..939b784b3efd993b15d07e15bf32c2feecbe2a25 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -894,18 +894,12 @@ class LibraryElementX extends ElementX implements LibraryElement {
bool hasLibraryName() => libraryTag != null;
/**
- * Returns the library name (as defined by the library tag) or for script
- * (which have no library tag) the script file name. The latter case is used
- * to private 'library name' for scripts to use for instance in dartdoc.
+ * Returns the library name, which is either the name given in the library tag
+ * or the empty string if there is no library tag.
*/
- String getLibraryOrScriptName() {
- if (libraryTag != null) {
- return libraryTag.name.toString();
- } else {
- // Use the file name as script name.
- String path = canonicalUri.path;
- return path.substring(path.lastIndexOf('/') + 1);
- }
+ String getLibraryName() {
+ if (libraryTag == null) return '';
+ return libraryTag.name.toString();
ahe 2013/10/10 11:47:53 Perhaps we need to cache this value.
}
Scope buildScope() => new LibraryScope(this);
@@ -917,17 +911,17 @@ class LibraryElementX extends ElementX implements LibraryElement {
String toString() {
if (origin != null) {
- return 'patch library(${getLibraryOrScriptName()})';
+ return 'patch library(${getLibraryName()})';
} else if (patch != null) {
- return 'origin library(${getLibraryOrScriptName()})';
+ return 'origin library(${getLibraryName()})';
} else {
- return 'library(${getLibraryOrScriptName()})';
+ return 'library(${getLibraryName()})';
}
}
int compareTo(LibraryElement other) {
if (this == other) return 0;
- return getLibraryOrScriptName().compareTo(other.getLibraryOrScriptName());
+ return getLibraryName().compareTo(other.getLibraryName());
ahe 2013/10/10 11:47:53 All the above should probably continue to use getL
}
}

Powered by Google App Engine
This is Rietveld 408576698