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 Names, Uris; | 9 import '../common/names.dart' show Identifiers, Names, Uris; |
10 import '../core_types.dart' show CoreClasses; | 10 import '../core_types.dart' show CoreClasses; |
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 | 13 |
14 import 'elements.dart'; | 14 import 'elements.dart'; |
15 | 15 |
16 abstract class ElementCommon implements Element { | 16 abstract class ElementCommon implements Element { |
17 @override | 17 @override |
18 bool get isLibrary => kind == ElementKind.LIBRARY; | 18 bool get isLibrary => kind == ElementKind.LIBRARY; |
19 | 19 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
600 bool get isInstanceMember { | 600 bool get isInstanceMember { |
601 return isClassMember && !isStatic; | 601 return isClassMember && !isStatic; |
602 } | 602 } |
603 | 603 |
604 @override | 604 @override |
605 bool get isAbstract { | 605 bool get isAbstract { |
606 return getter != null && getter.isAbstract || | 606 return getter != null && getter.isAbstract || |
607 setter != null && setter.isAbstract; | 607 setter != null && setter.isAbstract; |
608 } | 608 } |
609 } | 609 } |
610 | |
611 abstract class ConstructorElementCommon implements ConstructorElement { | |
612 @override | |
613 bool get isFromEnvironmentConstructor { | |
614 return name == Identifiers.fromEnvironment && | |
Siggi Cherem (dart-lang)
2016/06/03 17:57:03
would it be worth caching the results of this?
Johnni Winther
2016/06/13 07:49:20
Made a CL for it.
| |
615 library.isDartCore && | |
616 (enclosingClass.name == 'bool' || | |
617 enclosingClass.name == 'int' || | |
618 enclosingClass.name == 'String'); | |
619 } | |
620 | |
621 @override | |
622 bool get isIntFromEnvironmentConstructor { | |
623 return name == Identifiers.fromEnvironment && | |
624 library.isDartCore && | |
625 enclosingClass.name == 'int'; | |
626 } | |
627 | |
628 @override | |
629 bool get isBoolFromEnvironmentConstructor { | |
630 return name == Identifiers.fromEnvironment && | |
631 library.isDartCore && | |
632 enclosingClass.name == 'bool'; | |
633 } | |
634 | |
635 @override | |
636 bool get isStringFromEnvironmentConstructor { | |
637 return name == Identifiers.fromEnvironment && | |
638 library.isDartCore && | |
639 enclosingClass.name == 'String'; | |
640 } | |
641 } | |
OLD | NEW |