The exception occurs because the type can be set to null if the element is either a parameter or local variable element. This might be a change since the time this code was originally written.

R=danrubel@google.com

Review URL: https://codereview.chromium.org/1688493002 .
This commit is contained in:
Brian Wilkerson
2016-02-10 10:49:47 -08:00
parent a5390e8588
commit bcaedf2b7f
@@ -72,7 +72,8 @@ class TypeMemberContributor extends DartCompletionContributor {
} else if (elem is LocalVariableElement) {
type = elem.type;
}
if (type.isDynamic && expression is SimpleIdentifier) {
if ((type == null || type.isDynamic) &&
expression is SimpleIdentifier) {
// If the element does not provide a good type
// then attempt to get a better type from a local declaration
_LocalBestTypeVisitor visitor =