Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Unified Diff: pkg/analysis_server/lib/src/search/type_hierarchy.dart

Issue 962743003: Issue 22575. Fix for type hierarchy from FieldElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/search/type_hierarchy_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/search/type_hierarchy.dart
diff --git a/pkg/analysis_server/lib/src/search/type_hierarchy.dart b/pkg/analysis_server/lib/src/search/type_hierarchy.dart
index 009325db95d9dbd61c39616cf5d2da9df12423b0..949cd204925ae1d64f6637d1237a373a505fdc64 100644
--- a/pkg/analysis_server/lib/src/search/type_hierarchy.dart
+++ b/pkg/analysis_server/lib/src/search/type_hierarchy.dart
@@ -21,6 +21,7 @@ class TypeHierarchyComputer {
LibraryElement _pivotLibrary;
ElementKind _pivotKind;
+ bool _pivotFieldFinal;
String _pivotName;
final List<TypeHierarchyItem> _items = <TypeHierarchyItem>[];
@@ -37,6 +38,10 @@ class TypeHierarchyComputer {
_pivotLibrary = element.library;
_pivotKind = element.kind;
_pivotName = element.name;
+ if (element is FieldElement) {
+ _pivotFieldFinal = (element as FieldElement).isFinal;
+ element = element.enclosingElement;
+ }
if (element is ExecutableElement &&
element.enclosingElement is ClassElement) {
element = element.enclosingElement;
@@ -147,6 +152,11 @@ class TypeHierarchyComputer {
result = clazz.getGetter(_pivotName);
} else if (_pivotKind == ElementKind.SETTER) {
result = clazz.getSetter(_pivotName);
+ } else if (_pivotKind == ElementKind.FIELD) {
+ result = clazz.getGetter(_pivotName);
+ if (result == null && !_pivotFieldFinal) {
+ result = clazz.getSetter(_pivotName);
+ }
}
if (result != null) {
return result;
@@ -156,12 +166,15 @@ class TypeHierarchyComputer {
ClassElement mixinElement = mixin.element;
if (_pivotKind == ElementKind.METHOD) {
result = mixinElement.lookUpMethod(_pivotName, _pivotLibrary);
- }
- if (_pivotKind == ElementKind.GETTER) {
+ } else if (_pivotKind == ElementKind.GETTER) {
result = mixinElement.lookUpGetter(_pivotName, _pivotLibrary);
- }
- if (_pivotKind == ElementKind.SETTER) {
+ } else if (_pivotKind == ElementKind.SETTER) {
result = mixinElement.lookUpSetter(_pivotName, _pivotLibrary);
+ } else if (_pivotKind == ElementKind.FIELD) {
+ result = mixinElement.lookUpGetter(_pivotName, _pivotLibrary);
+ if (result == null && !_pivotFieldFinal) {
+ result = mixinElement.lookUpSetter(_pivotName, _pivotLibrary);
+ }
}
if (result != null) {
return result;
« no previous file with comments | « no previous file | pkg/analysis_server/test/search/type_hierarchy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698