| OLD | NEW |
| 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 CoreClasses; | 10 import '../core_types.dart' show CommonElements; |
| 11 import '../dart_types.dart' show DartType, InterfaceType, FunctionType; | 11 import '../dart_types.dart' show DartType, InterfaceType, FunctionType; |
| 12 import '../util/util.dart' show Link; | 12 import '../util/util.dart' show Link; |
| 13 import 'elements.dart'; | 13 import 'elements.dart'; |
| 14 | 14 |
| 15 abstract class ElementCommon implements Element { | 15 abstract class ElementCommon implements Element { |
| 16 @override | 16 @override |
| 17 bool get isLibrary => kind == ElementKind.LIBRARY; | 17 bool get isLibrary => kind == ElementKind.LIBRARY; |
| 18 | 18 |
| 19 @override | 19 @override |
| 20 bool get isCompilationUnit => kind == ElementKind.COMPILATION_UNIT; | 20 bool get isCompilationUnit => kind == ElementKind.COMPILATION_UNIT; |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 return false; | 432 return false; |
| 433 } | 433 } |
| 434 | 434 |
| 435 @override | 435 @override |
| 436 bool implementsInterface(ClassElement intrface) { | 436 bool implementsInterface(ClassElement intrface) { |
| 437 return this != intrface && | 437 return this != intrface && |
| 438 allSupertypesAndSelf.asInstanceOf(intrface) != null; | 438 allSupertypesAndSelf.asInstanceOf(intrface) != null; |
| 439 } | 439 } |
| 440 | 440 |
| 441 @override | 441 @override |
| 442 bool implementsFunction(CoreClasses coreClasses) { | 442 bool implementsFunction(CommonElements commonElements) { |
| 443 return asInstanceOf(coreClasses.functionClass) != null || callType != null; | 443 return asInstanceOf(commonElements.functionClass) != null || |
| 444 callType != null; |
| 444 } | 445 } |
| 445 | 446 |
| 446 @override | 447 @override |
| 447 bool isSubclassOf(ClassElement cls) { | 448 bool isSubclassOf(ClassElement cls) { |
| 448 // Use [declaration] for both [this] and [cls], because | 449 // Use [declaration] for both [this] and [cls], because |
| 449 // declaration classes hold the superclass hierarchy. | 450 // declaration classes hold the superclass hierarchy. |
| 450 cls = cls.declaration; | 451 cls = cls.declaration; |
| 451 for (ClassElement s = declaration; s != null; s = s.superclass) { | 452 for (ClassElement s = declaration; s != null; s = s.superclass) { |
| 452 if (identical(s, cls)) return true; | 453 if (identical(s, cls)) return true; |
| 453 } | 454 } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 @override | 645 @override |
| 645 bool get isBoolFromEnvironmentConstructor { | 646 bool get isBoolFromEnvironmentConstructor { |
| 646 return fromEnvironmentState == _FromEnvironmentState.BOOL; | 647 return fromEnvironmentState == _FromEnvironmentState.BOOL; |
| 647 } | 648 } |
| 648 | 649 |
| 649 @override | 650 @override |
| 650 bool get isStringFromEnvironmentConstructor { | 651 bool get isStringFromEnvironmentConstructor { |
| 651 return fromEnvironmentState == _FromEnvironmentState.STRING; | 652 return fromEnvironmentState == _FromEnvironmentState.STRING; |
| 652 } | 653 } |
| 653 } | 654 } |
| OLD | NEW |