Chromium Code Reviews| 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
|
| } |
| } |