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 services.hierarchy; | 5 library services.hierarchy; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analysis_server/src/services/search/element_visitors.dart'; | 10 import 'package:analysis_server/src/services/search/element_visitors.dart'; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 }); | 69 }); |
70 } | 70 } |
71 | 71 |
72 /** | 72 /** |
73 * @return all implementations of the given {@link ClassMemberElement} is its su
perclasses and | 73 * @return all implementations of the given {@link ClassMemberElement} is its su
perclasses and |
74 * their subclasses. | 74 * their subclasses. |
75 */ | 75 */ |
76 Future<Set<ClassMemberElement>> getHierarchyMembers( | 76 Future<Set<ClassMemberElement>> getHierarchyMembers( |
77 SearchEngine searchEngine, ClassMemberElement member) { | 77 SearchEngine searchEngine, ClassMemberElement member) { |
78 Set<ClassMemberElement> result = new HashSet<ClassMemberElement>(); | 78 Set<ClassMemberElement> result = new HashSet<ClassMemberElement>(); |
79 // constructor | 79 // static elements |
80 if (member is ConstructorElement) { | 80 if (member.isStatic || member is ConstructorElement) { |
81 result.add(member); | 81 result.add(member); |
82 return new Future.value(result); | 82 return new Future.value(result); |
83 } | 83 } |
84 // method, field, etc | 84 // method, field, etc |
85 String name = member.displayName; | 85 String name = member.displayName; |
86 ClassElement memberClass = member.enclosingElement; | 86 ClassElement memberClass = member.enclosingElement; |
87 List<Future> futures = <Future>[]; | 87 List<Future> futures = <Future>[]; |
88 Set<ClassElement> searchClasses = getSuperClasses(memberClass); | 88 Set<ClassElement> searchClasses = getSuperClasses(memberClass); |
89 searchClasses.add(memberClass); | 89 searchClasses.add(memberClass); |
90 for (ClassElement superClass in searchClasses) { | 90 for (ClassElement superClass in searchClasses) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 * its variable, otherwise returns [element]. | 181 * its variable, otherwise returns [element]. |
182 */ | 182 */ |
183 Element getSyntheticAccessorVariable(Element element) { | 183 Element getSyntheticAccessorVariable(Element element) { |
184 if (element is PropertyAccessorElement) { | 184 if (element is PropertyAccessorElement) { |
185 if (element.isSynthetic) { | 185 if (element.isSynthetic) { |
186 return element.variable; | 186 return element.variable; |
187 } | 187 } |
188 } | 188 } |
189 return element; | 189 return element; |
190 } | 190 } |
OLD | NEW |