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 CoreClasses; |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 return isClassMember && !isStatic; | 594 return isClassMember && !isStatic; |
595 } | 595 } |
596 | 596 |
597 @override | 597 @override |
598 bool get isAbstract { | 598 bool get isAbstract { |
599 return getter != null && getter.isAbstract || | 599 return getter != null && getter.isAbstract || |
600 setter != null && setter.isAbstract; | 600 setter != null && setter.isAbstract; |
601 } | 601 } |
602 } | 602 } |
603 | 603 |
604 enum _FromEnvironmentState { NOT, BOOL, INT, STRING, } | 604 enum _FromEnvironmentState { |
| 605 NOT, |
| 606 BOOL, |
| 607 INT, |
| 608 STRING, |
| 609 } |
605 | 610 |
606 abstract class ConstructorElementCommon implements ConstructorElement { | 611 abstract class ConstructorElementCommon implements ConstructorElement { |
607 _FromEnvironmentState _fromEnvironmentState; | 612 _FromEnvironmentState _fromEnvironmentState; |
608 | 613 |
609 _FromEnvironmentState get fromEnvironmentState { | 614 _FromEnvironmentState get fromEnvironmentState { |
610 if (_fromEnvironmentState == null) { | 615 if (_fromEnvironmentState == null) { |
611 _fromEnvironmentState = _FromEnvironmentState.NOT; | 616 _fromEnvironmentState = _FromEnvironmentState.NOT; |
612 if (name == Identifiers.fromEnvironment && library.isDartCore) { | 617 if (name == Identifiers.fromEnvironment && library.isDartCore) { |
613 switch (enclosingClass.name) { | 618 switch (enclosingClass.name) { |
614 case 'bool': | 619 case 'bool': |
(...skipping 24 matching lines...) Expand all Loading... |
639 @override | 644 @override |
640 bool get isBoolFromEnvironmentConstructor { | 645 bool get isBoolFromEnvironmentConstructor { |
641 return fromEnvironmentState == _FromEnvironmentState.BOOL; | 646 return fromEnvironmentState == _FromEnvironmentState.BOOL; |
642 } | 647 } |
643 | 648 |
644 @override | 649 @override |
645 bool get isStringFromEnvironmentConstructor { | 650 bool get isStringFromEnvironmentConstructor { |
646 return fromEnvironmentState == _FromEnvironmentState.STRING; | 651 return fromEnvironmentState == _FromEnvironmentState.STRING; |
647 } | 652 } |
648 } | 653 } |
OLD | NEW |