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 '../common_elements.dart' show CommonElements; | 10 import '../common_elements.dart' show CommonElements; |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 604 } |
605 | 605 |
606 enum _FromEnvironmentState { | 606 enum _FromEnvironmentState { |
607 NOT, | 607 NOT, |
608 BOOL, | 608 BOOL, |
609 INT, | 609 INT, |
610 STRING, | 610 STRING, |
611 } | 611 } |
612 | 612 |
613 abstract class ConstructorElementCommon implements ConstructorElement { | 613 abstract class ConstructorElementCommon implements ConstructorElement { |
| 614 LibraryElement get library; |
| 615 |
614 _FromEnvironmentState _fromEnvironmentState; | 616 _FromEnvironmentState _fromEnvironmentState; |
615 | 617 |
616 _FromEnvironmentState get fromEnvironmentState { | 618 _FromEnvironmentState get fromEnvironmentState { |
617 if (_fromEnvironmentState == null) { | 619 if (_fromEnvironmentState == null) { |
618 _fromEnvironmentState = _FromEnvironmentState.NOT; | 620 _fromEnvironmentState = _FromEnvironmentState.NOT; |
619 if (name == Identifiers.fromEnvironment && library.isDartCore) { | 621 if (name == Identifiers.fromEnvironment && library.isDartCore) { |
620 switch (enclosingClass.name) { | 622 switch (enclosingClass.name) { |
621 case 'bool': | 623 case 'bool': |
622 _fromEnvironmentState = _FromEnvironmentState.BOOL; | 624 _fromEnvironmentState = _FromEnvironmentState.BOOL; |
623 break; | 625 break; |
(...skipping 22 matching lines...) Expand all Loading... |
646 @override | 648 @override |
647 bool get isBoolFromEnvironmentConstructor { | 649 bool get isBoolFromEnvironmentConstructor { |
648 return fromEnvironmentState == _FromEnvironmentState.BOOL; | 650 return fromEnvironmentState == _FromEnvironmentState.BOOL; |
649 } | 651 } |
650 | 652 |
651 @override | 653 @override |
652 bool get isStringFromEnvironmentConstructor { | 654 bool get isStringFromEnvironmentConstructor { |
653 return fromEnvironmentState == _FromEnvironmentState.STRING; | 655 return fromEnvironmentState == _FromEnvironmentState.STRING; |
654 } | 656 } |
655 } | 657 } |
OLD | NEW |