| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 3642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3653 buffer.write(displayName); | 3653 buffer.write(displayName); |
| 3654 super.appendTo(buffer); | 3654 super.appendTo(buffer); |
| 3655 } | 3655 } |
| 3656 | 3656 |
| 3657 @override | 3657 @override |
| 3658 MethodDeclaration computeNode() => | 3658 MethodDeclaration computeNode() => |
| 3659 getNodeMatching((node) => node is MethodDeclaration); | 3659 getNodeMatching((node) => node is MethodDeclaration); |
| 3660 } | 3660 } |
| 3661 | 3661 |
| 3662 /** | 3662 /** |
| 3663 * The enumeration `Modifier` defines constants for all of the modifiers defined |
| 3664 * by the Dart language and for a few additional flags that are useful. |
| 3665 * |
| 3666 * Clients may not extend, implement or mix-in this class. |
| 3667 */ |
| 3668 class Modifier extends Enum<Modifier> { |
| 3669 /** |
| 3670 * Indicates that the modifier 'abstract' was applied to the element. |
| 3671 */ |
| 3672 static const Modifier ABSTRACT = const Modifier('ABSTRACT', 0); |
| 3673 |
| 3674 /** |
| 3675 * Indicates that an executable element has a body marked as being |
| 3676 * asynchronous. |
| 3677 */ |
| 3678 static const Modifier ASYNCHRONOUS = const Modifier('ASYNCHRONOUS', 1); |
| 3679 |
| 3680 /** |
| 3681 * Indicates that the modifier 'const' was applied to the element. |
| 3682 */ |
| 3683 static const Modifier CONST = const Modifier('CONST', 2); |
| 3684 |
| 3685 /** |
| 3686 * Indicates that the import element represents a deferred library. |
| 3687 */ |
| 3688 static const Modifier DEFERRED = const Modifier('DEFERRED', 3); |
| 3689 |
| 3690 /** |
| 3691 * Indicates that a class element was defined by an enum declaration. |
| 3692 */ |
| 3693 static const Modifier ENUM = const Modifier('ENUM', 4); |
| 3694 |
| 3695 /** |
| 3696 * Indicates that a class element was defined by an enum declaration. |
| 3697 */ |
| 3698 static const Modifier EXTERNAL = const Modifier('EXTERNAL', 5); |
| 3699 |
| 3700 /** |
| 3701 * Indicates that the modifier 'factory' was applied to the element. |
| 3702 */ |
| 3703 static const Modifier FACTORY = const Modifier('FACTORY', 6); |
| 3704 |
| 3705 /** |
| 3706 * Indicates that the modifier 'final' was applied to the element. |
| 3707 */ |
| 3708 static const Modifier FINAL = const Modifier('FINAL', 7); |
| 3709 |
| 3710 /** |
| 3711 * Indicates that an executable element has a body marked as being a |
| 3712 * generator. |
| 3713 */ |
| 3714 static const Modifier GENERATOR = const Modifier('GENERATOR', 8); |
| 3715 |
| 3716 /** |
| 3717 * Indicates that the pseudo-modifier 'get' was applied to the element. |
| 3718 */ |
| 3719 static const Modifier GETTER = const Modifier('GETTER', 9); |
| 3720 |
| 3721 /** |
| 3722 * A flag used for libraries indicating that the defining compilation unit |
| 3723 * contains at least one import directive whose URI uses the "dart-ext" |
| 3724 * scheme. |
| 3725 */ |
| 3726 static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 10); |
| 3727 |
| 3728 /** |
| 3729 * Indicates that the associated element did not have an explicit type |
| 3730 * associated with it. If the element is an [ExecutableElement], then the |
| 3731 * type being referred to is the return type. |
| 3732 */ |
| 3733 static const Modifier IMPLICIT_TYPE = const Modifier('IMPLICIT_TYPE', 11); |
| 3734 |
| 3735 /** |
| 3736 * Indicates that a class is a mixin application. |
| 3737 */ |
| 3738 static const Modifier MIXIN_APPLICATION = |
| 3739 const Modifier('MIXIN_APPLICATION', 12); |
| 3740 |
| 3741 /** |
| 3742 * Indicates that the value of a parameter or local variable might be mutated |
| 3743 * within the context. |
| 3744 */ |
| 3745 static const Modifier POTENTIALLY_MUTATED_IN_CONTEXT = |
| 3746 const Modifier('POTENTIALLY_MUTATED_IN_CONTEXT', 13); |
| 3747 |
| 3748 /** |
| 3749 * Indicates that the value of a parameter or local variable might be mutated |
| 3750 * within the scope. |
| 3751 */ |
| 3752 static const Modifier POTENTIALLY_MUTATED_IN_SCOPE = |
| 3753 const Modifier('POTENTIALLY_MUTATED_IN_SCOPE', 14); |
| 3754 |
| 3755 /** |
| 3756 * Indicates that a class contains an explicit reference to 'super'. |
| 3757 */ |
| 3758 static const Modifier REFERENCES_SUPER = |
| 3759 const Modifier('REFERENCES_SUPER', 15); |
| 3760 |
| 3761 /** |
| 3762 * Indicates that the pseudo-modifier 'set' was applied to the element. |
| 3763 */ |
| 3764 static const Modifier SETTER = const Modifier('SETTER', 16); |
| 3765 |
| 3766 /** |
| 3767 * Indicates that the modifier 'static' was applied to the element. |
| 3768 */ |
| 3769 static const Modifier STATIC = const Modifier('STATIC', 17); |
| 3770 |
| 3771 /** |
| 3772 * Indicates that the element does not appear in the source code but was |
| 3773 * implicitly created. For example, if a class does not define any |
| 3774 * constructors, an implicit zero-argument constructor will be created and it |
| 3775 * will be marked as being synthetic. |
| 3776 */ |
| 3777 static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 18); |
| 3778 |
| 3779 static const List<Modifier> values = const [ |
| 3780 ABSTRACT, |
| 3781 ASYNCHRONOUS, |
| 3782 CONST, |
| 3783 DEFERRED, |
| 3784 ENUM, |
| 3785 EXTERNAL, |
| 3786 FACTORY, |
| 3787 FINAL, |
| 3788 GENERATOR, |
| 3789 GETTER, |
| 3790 HAS_EXT_URI, |
| 3791 IMPLICIT_TYPE, |
| 3792 MIXIN_APPLICATION, |
| 3793 POTENTIALLY_MUTATED_IN_CONTEXT, |
| 3794 POTENTIALLY_MUTATED_IN_SCOPE, |
| 3795 REFERENCES_SUPER, |
| 3796 SETTER, |
| 3797 STATIC, |
| 3798 SYNTHETIC |
| 3799 ]; |
| 3800 |
| 3801 const Modifier(String name, int ordinal) : super(name, ordinal); |
| 3802 } |
| 3803 |
| 3804 /** |
| 3663 * A concrete implementation of a [MultiplyDefinedElement]. | 3805 * A concrete implementation of a [MultiplyDefinedElement]. |
| 3664 */ | 3806 */ |
| 3665 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { | 3807 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { |
| 3666 /** | 3808 /** |
| 3667 * The unique integer identifier of this element. | 3809 * The unique integer identifier of this element. |
| 3668 */ | 3810 */ |
| 3669 final int id = ElementImpl._NEXT_ID++; | 3811 final int id = ElementImpl._NEXT_ID++; |
| 3670 | 3812 |
| 3671 /** | 3813 /** |
| 3672 * The analysis context in which the multiply defined elements are defined. | 3814 * The analysis context in which the multiply defined elements are defined. |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4606 | 4748 |
| 4607 @override | 4749 @override |
| 4608 void visitElement(Element element) { | 4750 void visitElement(Element element) { |
| 4609 int offset = element.nameOffset; | 4751 int offset = element.nameOffset; |
| 4610 if (offset != -1) { | 4752 if (offset != -1) { |
| 4611 map[offset] = element; | 4753 map[offset] = element; |
| 4612 } | 4754 } |
| 4613 super.visitElement(element); | 4755 super.visitElement(element); |
| 4614 } | 4756 } |
| 4615 } | 4757 } |
| OLD | NEW |