Index: pkg/analyzer/lib/src/generated/element_resolver.dart |
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart |
index e10f99b70b0a8ff1d4a7c9061c811dc863d33a05..886da2a2dc0ae5c91f62823b128ccbfba9802df8 100644 |
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart |
@@ -1031,6 +1031,7 @@ class ElementResolver extends SimpleAstVisitor<Object> { |
} |
} |
node.staticElement = element; |
+ _markElementUsed(element); |
if (node.inSetterContext() && node.inGetterContext() && enclosingClass != null) { |
InterfaceType enclosingType = enclosingClass.type; |
AuxiliaryElements auxiliaryElements = new AuxiliaryElements(_lookUpGetter(null, enclosingType, node.name), null); |
@@ -1902,6 +1903,29 @@ class ElementResolver extends SimpleAstVisitor<Object> { |
} |
/** |
+ * Marks [element] as used in its defining library. |
+ */ |
+ void _markElementUsed(Element element) { |
+ // only locally defined elements |
+ if (element == null) { |
+ return; |
+ } |
+ if (!identical(element.library, _definingLibrary)) { |
+ return; |
+ } |
+ // convert members to base elements |
+ if (element is Member) { |
+ element = (element as Member).baseElement; |
+ } |
+ // ignore references to an element from itself |
+ if (identical(element, _resolver.enclosingClass)) { |
+ return; |
+ } |
+ // OK, the element is used |
+ (element as ElementImpl).markUsed(); |
+ } |
+ |
+ /** |
* Given some class element, this method uses [subtypeManager] to find the set of all |
* subtypes; the subtypes are then searched for a member (method, getter, or setter), that matches |
* a passed |