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

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

Issue 2808763005: Extract OrderedTypeSetBuilderBase from OrderedTypeSetBuilder (Closed)
Patch Set: Created 3 years, 8 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/deferred_load.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 Identifiers, Names, Uris; 9 import '../common/names.dart' show Identifiers, Names, Uris;
10 import '../common_elements.dart' show CommonElements; 10 import '../common_elements.dart' show CommonElements;
11 import '../util/util.dart' show Link; 11 import '../util/util.dart' show Link;
12 import 'entities.dart'; 12 import 'entities.dart';
13 import 'elements.dart'; 13 import 'elements.dart';
14 import 'types.dart';
14 import 'resolution_types.dart' 15 import 'resolution_types.dart'
15 show ResolutionDartType, ResolutionInterfaceType, ResolutionFunctionType; 16 show ResolutionDartType, ResolutionInterfaceType, ResolutionFunctionType;
16 17
17 abstract class ElementCommon implements Element { 18 abstract class ElementCommon implements Element {
18 @override 19 @override
19 bool get isLibrary => kind == ElementKind.LIBRARY; 20 bool get isLibrary => kind == ElementKind.LIBRARY;
20 21
21 @override 22 @override
22 bool get isCompilationUnit => kind == ElementKind.COMPILATION_UNIT; 23 bool get isCompilationUnit => kind == ElementKind.COMPILATION_UNIT;
23 24
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 String path = canonicalUri.path; 184 String path = canonicalUri.path;
184 return path.substring(path.lastIndexOf('/') + 1); 185 return path.substring(path.lastIndexOf('/') + 1);
185 } 186 }
186 } 187 }
187 } 188 }
188 189
189 abstract class CompilationUnitElementCommon implements CompilationUnitElement {} 190 abstract class CompilationUnitElementCommon implements CompilationUnitElement {}
190 191
191 abstract class ClassElementCommon implements ClassElement { 192 abstract class ClassElementCommon implements ClassElement {
192 @override 193 @override
193 Link<ResolutionDartType> get allSupertypes => allSupertypesAndSelf.supertypes; 194 Link<InterfaceType> get allSupertypes => allSupertypesAndSelf.supertypes;
194 195
195 @override 196 @override
196 int get hierarchyDepth => allSupertypesAndSelf.maxDepth; 197 int get hierarchyDepth => allSupertypesAndSelf.maxDepth;
197 198
198 @override 199 @override
199 ResolutionInterfaceType asInstanceOf(ClassElement cls) { 200 ResolutionInterfaceType asInstanceOf(ClassElement cls) {
200 if (cls == this) return thisType; 201 if (cls == this) return thisType;
201 return allSupertypesAndSelf.asInstanceOf(cls); 202 return allSupertypesAndSelf.asInstanceOf(cls, cls.hierarchyDepth);
202 } 203 }
203 204
204 @override 205 @override
205 ConstructorElement lookupConstructor(String name) { 206 ConstructorElement lookupConstructor(String name) {
206 Element result = localLookup(name); 207 Element result = localLookup(name);
207 return result != null && result.isConstructor ? result : null; 208 return result != null && result.isConstructor ? result : null;
208 } 209 }
209 210
210 /** 211 /**
211 * Find the first member in the class chain with the given [memberName]. 212 * Find the first member in the class chain with the given [memberName].
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 return true; 429 return true;
429 } 430 }
430 } 431 }
431 } 432 }
432 lookupClass = lookupClass.superclass; 433 lookupClass = lookupClass.superclass;
433 } 434 }
434 return false; 435 return false;
435 } 436 }
436 437
437 @override 438 @override
438 bool implementsInterface(ClassElement intrface) { 439 bool implementsInterface(ClassElement interface) {
439 return this != intrface && 440 return this != interface &&
440 allSupertypesAndSelf.asInstanceOf(intrface) != null; 441 allSupertypesAndSelf.asInstanceOf(
442 interface, interface.hierarchyDepth) !=
443 null;
441 } 444 }
442 445
443 @override 446 @override
444 bool implementsFunction(CommonElements commonElements) { 447 bool implementsFunction(CommonElements commonElements) {
445 return asInstanceOf(commonElements.functionClass) != null || 448 return asInstanceOf(commonElements.functionClass) != null ||
446 callType != null; 449 callType != null;
447 } 450 }
448 451
449 @override 452 @override
450 bool isSubclassOf(ClassElement cls) { 453 bool isSubclassOf(ClassElement cls) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 @override 672 @override
670 bool get isBoolFromEnvironmentConstructor { 673 bool get isBoolFromEnvironmentConstructor {
671 return fromEnvironmentState == _FromEnvironmentState.BOOL; 674 return fromEnvironmentState == _FromEnvironmentState.BOOL;
672 } 675 }
673 676
674 @override 677 @override
675 bool get isStringFromEnvironmentConstructor { 678 bool get isStringFromEnvironmentConstructor {
676 return fromEnvironmentState == _FromEnvironmentState.STRING; 679 return fromEnvironmentState == _FromEnvironmentState.STRING;
677 } 680 }
678 } 681 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698