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

Unified Diff: pkg/compiler/lib/src/elements/common.dart

Issue 1192103002: Support serialization of the compiler backbone. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Handle (bypass) external const constructors. Created 5 years, 5 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
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/common.dart
diff --git a/pkg/compiler/lib/src/elements/common.dart b/pkg/compiler/lib/src/elements/common.dart
index 8c8c4ffb2085b2f01d3a44f7b7c70e91a9c2a8b5..f9013c609ff3ce620794df46253f7c35bcf7aa7b 100644
--- a/pkg/compiler/lib/src/elements/common.dart
+++ b/pkg/compiler/lib/src/elements/common.dart
@@ -126,6 +126,28 @@ abstract class LibraryElementCommon implements LibraryElement {
@override
bool get isInternalLibrary =>
isPlatformLibrary && canonicalUri.path.startsWith('_');
+
+ String getLibraryOrScriptName() {
+ if (hasLibraryName()) {
+ return getLibraryName();
+ } else {
+ // Use the file name as script name.
+ String path = canonicalUri.path;
+ return path.substring(path.lastIndexOf('/') + 1);
+ }
+ }
+
+ int compareTo(LibraryElement other) {
+ if (this == other) return 0;
+ return getLibraryOrScriptName().compareTo(other.getLibraryOrScriptName());
+ }
+}
+
+abstract class CompilationUnitElementCommon implements CompilationUnitElement {
+ int compareTo(CompilationUnitElement other) {
+ if (this == other) return 0;
+ return '${script.readableUri}'.compareTo('${other.script.readableUri}');
+ }
}
abstract class ClassElementCommon implements ClassElement {
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698