Element staticElement = propertyName.getStaticElement();
Type staticType = dynamicType;
if (staticElement instanceof MethodElement) {
staticType = ((MethodElement) staticElement).getType();
} else if (staticElement instanceof PropertyAccessorElement) {
Expression realTarget = node.getRealTarget();
staticType = getTypeOfProperty((PropertyAccessorElement) staticElement, realTarget != null
? getStaticType(realTarget) : null);
} else {
// TODO(brianwilkerson) Report this internal error.
}
recordStaticType(propertyName, staticType);
recordStaticType(node, staticType);
Element propagatedElement = propertyName.getPropagatedElement();
Type propagatedType = overrideManager.getType(propagatedElement);
if (propagatedElement instanceof MethodElement) {
propagatedType = ((MethodElement) propagatedElement).getType();
} else if (propagatedElement instanceof PropertyAccessorElement) {
Expression realTarget = node.getRealTarget();
propagatedType = getTypeOfProperty(
(PropertyAccessorElement) propagatedElement,
realTarget != null ? realTarget.getBestType() : null);
} else {
// TODO(brianwilkerson) Report this internal error.
}
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
recordPropagatedType(propertyName, propagatedType);