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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Mixins that implement convenience methods on [Element] subclasses. 5 /// Mixins that implement convenience methods on [Element] subclasses.
6 6
7 library elements.common; 7 library elements.common;
8 8
9 import '../dart2jslib.dart' show Compiler, isPrivateName; 9 import '../dart2jslib.dart' show Compiler, isPrivateName;
10 import '../dart_types.dart' show DartType, InterfaceType, FunctionType; 10 import '../dart_types.dart' show DartType, InterfaceType, FunctionType;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 @override 120 @override
121 bool get isPlatformLibrary => canonicalUri.scheme == 'dart'; 121 bool get isPlatformLibrary => canonicalUri.scheme == 'dart';
122 122
123 @override 123 @override
124 bool get isPackageLibrary => canonicalUri.scheme == 'package'; 124 bool get isPackageLibrary => canonicalUri.scheme == 'package';
125 125
126 @override 126 @override
127 bool get isInternalLibrary => 127 bool get isInternalLibrary =>
128 isPlatformLibrary && canonicalUri.path.startsWith('_'); 128 isPlatformLibrary && canonicalUri.path.startsWith('_');
129
130 String getLibraryOrScriptName() {
131 if (hasLibraryName()) {
132 return getLibraryName();
133 } else {
134 // Use the file name as script name.
135 String path = canonicalUri.path;
136 return path.substring(path.lastIndexOf('/') + 1);
137 }
138 }
139
140 int compareTo(LibraryElement other) {
141 if (this == other) return 0;
142 return getLibraryOrScriptName().compareTo(other.getLibraryOrScriptName());
143 }
144 }
145
146 abstract class CompilationUnitElementCommon implements CompilationUnitElement {
147 int compareTo(CompilationUnitElement other) {
148 if (this == other) return 0;
149 return '${script.readableUri}'.compareTo('${other.script.readableUri}');
150 }
129 } 151 }
130 152
131 abstract class ClassElementCommon implements ClassElement { 153 abstract class ClassElementCommon implements ClassElement {
132 154
133 @override 155 @override
134 Link<DartType> get allSupertypes => allSupertypesAndSelf.supertypes; 156 Link<DartType> get allSupertypes => allSupertypesAndSelf.supertypes;
135 157
136 @override 158 @override
137 int get hierarchyDepth => allSupertypesAndSelf.maxDepth; 159 int get hierarchyDepth => allSupertypesAndSelf.maxDepth;
138 160
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // this signature must not have more required parameters. Having more 485 // this signature must not have more required parameters. Having more
464 // optional parameters is not a problem, they simply are never provided 486 // optional parameters is not a problem, they simply are never provided
465 // by call sites of a call to a method with the other signature. 487 // by call sites of a call to a method with the other signature.
466 int otherTotalCount = signature.parameterCount; 488 int otherTotalCount = signature.parameterCount;
467 return requiredParameterCount <= otherTotalCount 489 return requiredParameterCount <= otherTotalCount
468 && parameterCount >= otherTotalCount; 490 && parameterCount >= otherTotalCount;
469 } 491 }
470 return true; 492 return true;
471 } 493 }
472 } 494 }
OLDNEW
« 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