| 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 17 matching lines...) Expand all Loading... |
| 28 /** | 28 /** |
| 29 * Returns direct non-synthetic children of the given [ClassElement]. | 29 * Returns direct non-synthetic children of the given [ClassElement]. |
| 30 * | 30 * |
| 31 * Includes: fields, accessors and methods. | 31 * Includes: fields, accessors and methods. |
| 32 * Excludes: constructors and synthetic elements. | 32 * Excludes: constructors and synthetic elements. |
| 33 */ | 33 */ |
| 34 List<Element> getClassMembers(ClassElement clazz, [String name]) { | 34 List<Element> getClassMembers(ClassElement clazz, [String name]) { |
| 35 List<Element> members = <Element>[]; | 35 List<Element> members = <Element>[]; |
| 36 visitChildren(clazz, (Element element) { | 36 visitChildren(clazz, (Element element) { |
| 37 if (element.isSynthetic) { | 37 if (element.isSynthetic) { |
| 38 return; | 38 return false; |
| 39 } | 39 } |
| 40 if (element is ConstructorElement) { | 40 if (element is ConstructorElement) { |
| 41 return; | 41 return false; |
| 42 } | 42 } |
| 43 if (name != null && element.displayName != name) { | 43 if (name != null && element.displayName != name) { |
| 44 return; | 44 return false; |
| 45 } | 45 } |
| 46 if (element is ExecutableElement) { | 46 if (element is ExecutableElement) { |
| 47 members.add(element); | 47 members.add(element); |
| 48 } | 48 } |
| 49 if (element is FieldElement) { | 49 if (element is FieldElement) { |
| 50 members.add(element); | 50 members.add(element); |
| 51 } | 51 } |
| 52 return false; |
| 52 }); | 53 }); |
| 53 return members; | 54 return members; |
| 54 } | 55 } |
| 55 | 56 |
| 56 /** | 57 /** |
| 57 * Returns a [Set] with direct subclasses of [seed]. | 58 * Returns a [Set] with direct subclasses of [seed]. |
| 58 */ | 59 */ |
| 59 Future<Set<ClassElement>> getDirectSubClasses( | 60 Future<Set<ClassElement>> getDirectSubClasses( |
| 60 SearchEngine searchEngine, ClassElement seed) { | 61 SearchEngine searchEngine, ClassElement seed) { |
| 61 return searchEngine.searchSubtypes(seed).then((List<SearchMatch> matches) { | 62 return searchEngine.searchSubtypes(seed).then((List<SearchMatch> matches) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 * its variable, otherwise returns [element]. | 181 * its variable, otherwise returns [element]. |
| 181 */ | 182 */ |
| 182 Element getSyntheticAccessorVariable(Element element) { | 183 Element getSyntheticAccessorVariable(Element element) { |
| 183 if (element is PropertyAccessorElement) { | 184 if (element is PropertyAccessorElement) { |
| 184 if (element.isSynthetic) { | 185 if (element.isSynthetic) { |
| 185 return element.variable; | 186 return element.variable; |
| 186 } | 187 } |
| 187 } | 188 } |
| 188 return element; | 189 return element; |
| 189 } | 190 } |
| OLD | NEW |