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

Side by Side Diff: pkg/compiler/lib/src/elements/common.dart

Issue 1335983004: Add ImportElement and ExportElement (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 3 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/dump_info.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 '../common/names.dart' show 9 import '../common/names.dart' show
10 Names, 10 Names,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 @override 126 @override
127 bool get isPlatformLibrary => canonicalUri.scheme == 'dart'; 127 bool get isPlatformLibrary => canonicalUri.scheme == 'dart';
128 128
129 @override 129 @override
130 bool get isPackageLibrary => canonicalUri.scheme == 'package'; 130 bool get isPackageLibrary => canonicalUri.scheme == 'package';
131 131
132 @override 132 @override
133 bool get isInternalLibrary => 133 bool get isInternalLibrary =>
134 isPlatformLibrary && canonicalUri.path.startsWith('_'); 134 isPlatformLibrary && canonicalUri.path.startsWith('_');
135 135
136 String getLibraryOrScriptName() { 136 String get libraryOrScriptName {
137 if (hasLibraryName()) { 137 if (hasLibraryName) {
138 return getLibraryName(); 138 return libraryName;
139 } else { 139 } else {
140 // Use the file name as script name. 140 // Use the file name as script name.
141 String path = canonicalUri.path; 141 String path = canonicalUri.path;
142 return path.substring(path.lastIndexOf('/') + 1); 142 return path.substring(path.lastIndexOf('/') + 1);
143 } 143 }
144 } 144 }
145 145
146 int compareTo(LibraryElement other) { 146 int compareTo(LibraryElement other) {
147 if (this == other) return 0; 147 if (this == other) return 0;
148 return getLibraryOrScriptName().compareTo(other.getLibraryOrScriptName()); 148 return libraryOrScriptName.compareTo(other.libraryOrScriptName);
149 } 149 }
150 } 150 }
151 151
152 abstract class CompilationUnitElementCommon implements CompilationUnitElement { 152 abstract class CompilationUnitElementCommon implements CompilationUnitElement {
153 int compareTo(CompilationUnitElement other) { 153 int compareTo(CompilationUnitElement other) {
154 if (this == other) return 0; 154 if (this == other) return 0;
155 return '${script.readableUri}'.compareTo('${other.script.readableUri}'); 155 return '${script.readableUri}'.compareTo('${other.script.readableUri}');
156 } 156 }
157 } 157 }
158 158
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // this signature must not have more required parameters. Having more 490 // this signature must not have more required parameters. Having more
491 // optional parameters is not a problem, they simply are never provided 491 // optional parameters is not a problem, they simply are never provided
492 // by call sites of a call to a method with the other signature. 492 // by call sites of a call to a method with the other signature.
493 int otherTotalCount = signature.parameterCount; 493 int otherTotalCount = signature.parameterCount;
494 return requiredParameterCount <= otherTotalCount 494 return requiredParameterCount <= otherTotalCount
495 && parameterCount >= otherTotalCount; 495 && parameterCount >= otherTotalCount;
496 } 496 }
497 return true; 497 return true;
498 } 498 }
499 } 499 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dump_info.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698