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

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

Issue 2603263002: Prefix resolution_types with Resolution. (Closed)
Patch Set: Rebased Created 3 years, 11 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 '../core_types.dart' show CommonElements; 10 import '../core_types.dart' show CommonElements;
11 import '../util/util.dart' show Link; 11 import '../util/util.dart' show Link;
12 import 'elements.dart'; 12 import 'elements.dart';
13 import 'resolution_types.dart' show DartType, InterfaceType, FunctionType; 13 import 'resolution_types.dart'
14 show ResolutionDartType, ResolutionInterfaceType, ResolutionFunctionType;
14 15
15 abstract class ElementCommon implements Element { 16 abstract class ElementCommon implements Element {
16 @override 17 @override
17 bool get isLibrary => kind == ElementKind.LIBRARY; 18 bool get isLibrary => kind == ElementKind.LIBRARY;
18 19
19 @override 20 @override
20 bool get isCompilationUnit => kind == ElementKind.COMPILATION_UNIT; 21 bool get isCompilationUnit => kind == ElementKind.COMPILATION_UNIT;
21 22
22 @override 23 @override
23 bool get isPrefix => kind == ElementKind.PREFIX; 24 bool get isPrefix => kind == ElementKind.PREFIX;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 String path = canonicalUri.path; 182 String path = canonicalUri.path;
182 return path.substring(path.lastIndexOf('/') + 1); 183 return path.substring(path.lastIndexOf('/') + 1);
183 } 184 }
184 } 185 }
185 } 186 }
186 187
187 abstract class CompilationUnitElementCommon implements CompilationUnitElement {} 188 abstract class CompilationUnitElementCommon implements CompilationUnitElement {}
188 189
189 abstract class ClassElementCommon implements ClassElement { 190 abstract class ClassElementCommon implements ClassElement {
190 @override 191 @override
191 Link<DartType> get allSupertypes => allSupertypesAndSelf.supertypes; 192 Link<ResolutionDartType> get allSupertypes => allSupertypesAndSelf.supertypes;
192 193
193 @override 194 @override
194 int get hierarchyDepth => allSupertypesAndSelf.maxDepth; 195 int get hierarchyDepth => allSupertypesAndSelf.maxDepth;
195 196
196 @override 197 @override
197 InterfaceType asInstanceOf(ClassElement cls) { 198 ResolutionInterfaceType asInstanceOf(ClassElement cls) {
198 if (cls == this) return thisType; 199 if (cls == this) return thisType;
199 return allSupertypesAndSelf.asInstanceOf(cls); 200 return allSupertypesAndSelf.asInstanceOf(cls);
200 } 201 }
201 202
202 @override 203 @override
203 ConstructorElement lookupConstructor(String name) { 204 ConstructorElement lookupConstructor(String name) {
204 Element result = localLookup(name); 205 Element result = localLookup(name);
205 return result != null && result.isConstructor ? result : null; 206 return result != null && result.isConstructor ? result : null;
206 } 207 }
207 208
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 bool isSubclassOf(ClassElement cls) { 449 bool isSubclassOf(ClassElement cls) {
449 // Use [declaration] for both [this] and [cls], because 450 // Use [declaration] for both [this] and [cls], because
450 // declaration classes hold the superclass hierarchy. 451 // declaration classes hold the superclass hierarchy.
451 cls = cls.declaration; 452 cls = cls.declaration;
452 for (ClassElement s = declaration; s != null; s = s.superclass) { 453 for (ClassElement s = declaration; s != null; s = s.superclass) {
453 if (identical(s, cls)) return true; 454 if (identical(s, cls)) return true;
454 } 455 }
455 return false; 456 return false;
456 } 457 }
457 458
458 FunctionType get callType { 459 ResolutionFunctionType get callType {
459 MemberSignature member = lookupInterfaceMember(Names.call); 460 MemberSignature member = lookupInterfaceMember(Names.call);
460 return member != null && member.isMethod ? member.type : null; 461 return member != null && member.isMethod ? member.type : null;
461 } 462 }
462 463
463 @override 464 @override
464 bool get isNamedMixinApplication { 465 bool get isNamedMixinApplication {
465 return isMixinApplication && !isUnnamedMixinApplication; 466 return isMixinApplication && !isUnnamedMixinApplication;
466 } 467 }
467 468
468 // backendMembers are members that have been added by the backend to simplify 469 // backendMembers are members that have been added by the backend to simplify
(...skipping 21 matching lines...) Expand all
490 } 491 }
491 return null; 492 return null;
492 } 493 }
493 494
494 void forEachBackendMember(void f(Element member)) { 495 void forEachBackendMember(void f(Element member)) {
495 backendMembers.forEach(f); 496 backendMembers.forEach(f);
496 } 497 }
497 } 498 }
498 499
499 abstract class FunctionSignatureCommon implements FunctionSignature { 500 abstract class FunctionSignatureCommon implements FunctionSignature {
500 DartType get returnType => type.returnType; 501 ResolutionDartType get returnType => type.returnType;
501 502
502 void forEachRequiredParameter(void function(Element parameter)) { 503 void forEachRequiredParameter(void function(Element parameter)) {
503 requiredParameters.forEach(function); 504 requiredParameters.forEach(function);
504 } 505 }
505 506
506 void forEachOptionalParameter(void function(Element parameter)) { 507 void forEachOptionalParameter(void function(Element parameter)) {
507 optionalParameters.forEach(function); 508 optionalParameters.forEach(function);
508 } 509 }
509 510
510 void forEachParameter(void function(Element parameter)) { 511 void forEachParameter(void function(Element parameter)) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 @override 646 @override
646 bool get isBoolFromEnvironmentConstructor { 647 bool get isBoolFromEnvironmentConstructor {
647 return fromEnvironmentState == _FromEnvironmentState.BOOL; 648 return fromEnvironmentState == _FromEnvironmentState.BOOL;
648 } 649 }
649 650
650 @override 651 @override
651 bool get isStringFromEnvironmentConstructor { 652 bool get isStringFromEnvironmentConstructor {
652 return fromEnvironmentState == _FromEnvironmentState.STRING; 653 return fromEnvironmentState == _FromEnvironmentState.STRING;
653 } 654 }
654 } 655 }
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