@@ -32,10 +32,60 @@ class PrefixedIdentifierResolver {
3232 hasWrite: false ,
3333 );
3434
35+ var element = result.readElement;
36+
3537 var identifier = node.identifier;
36- identifier.staticElement = result.readElement;
38+ identifier.staticElement = element;
39+
40+ if (element is ExtensionElement ) {
41+ _setExtensionIdentifierType (node);
42+ return ;
43+ }
3744
38- _resolve2 (node);
45+ if (identical (node.prefix.staticType, NeverTypeImpl .instance)) {
46+ _recordStaticType (identifier, NeverTypeImpl .instance);
47+ _recordStaticType (node, NeverTypeImpl .instance);
48+ return ;
49+ }
50+
51+ DartType type = DynamicTypeImpl .instance;
52+ if (element is ClassElement ) {
53+ if (_isExpressionIdentifier (node)) {
54+ var type = _typeProvider.typeType;
55+ node.staticType = type;
56+ identifier.staticType = type;
57+ }
58+ return ;
59+ } else if (element is DynamicElementImpl ) {
60+ var type = _typeProvider.typeType;
61+ node.staticType = type;
62+ identifier.staticType = type;
63+ return ;
64+ } else if (element is FunctionTypeAliasElement ) {
65+ if (node.parent is TypeName ) {
66+ // no type
67+ } else {
68+ var type = _typeProvider.typeType;
69+ node.staticType = type;
70+ identifier.staticType = type;
71+ }
72+ return ;
73+ } else if (element is MethodElement ) {
74+ type = element.type;
75+ } else if (element is PropertyAccessorElement ) {
76+ type = _getTypeOfProperty (element);
77+ } else if (element is ExecutableElement ) {
78+ type = element.type;
79+ } else if (element is VariableElement ) {
80+ type = element.type;
81+ } else if (result.functionTypeCallType != null ) {
82+ type = result.functionTypeCallType;
83+ }
84+
85+ type = _inferenceHelper.inferTearOff (node, identifier, type);
86+
87+ _recordStaticType (identifier, type);
88+ _recordStaticType (node, type);
3989 }
4090
4191 /// Return the type that should be recorded for a node that resolved to the given accessor.
@@ -103,60 +153,6 @@ class PrefixedIdentifierResolver {
103153 _inferenceHelper.recordStaticType (expression, type);
104154 }
105155
106- void _resolve2 (PrefixedIdentifier node) {
107- SimpleIdentifier prefixedIdentifier = node.identifier;
108- Element staticElement = prefixedIdentifier.staticElement;
109-
110- if (staticElement is ExtensionElement ) {
111- _setExtensionIdentifierType (node);
112- return ;
113- }
114-
115- if (identical (node.prefix.staticType, NeverTypeImpl .instance)) {
116- _recordStaticType (prefixedIdentifier, NeverTypeImpl .instance);
117- _recordStaticType (node, NeverTypeImpl .instance);
118- return ;
119- }
120-
121- DartType staticType = DynamicTypeImpl .instance;
122- if (staticElement is ClassElement ) {
123- if (_isExpressionIdentifier (node)) {
124- var type = _typeProvider.typeType;
125- node.staticType = type;
126- node.identifier.staticType = type;
127- }
128- return ;
129- } else if (staticElement is DynamicElementImpl ) {
130- var type = _typeProvider.typeType;
131- node.staticType = type;
132- node.identifier.staticType = type;
133- return ;
134- } else if (staticElement is FunctionTypeAliasElement ) {
135- if (node.parent is TypeName ) {
136- // no type
137- } else {
138- var type = _typeProvider.typeType;
139- node.staticType = type;
140- node.identifier.staticType = type;
141- }
142- return ;
143- } else if (staticElement is MethodElement ) {
144- staticType = staticElement.type;
145- } else if (staticElement is PropertyAccessorElement ) {
146- staticType = _getTypeOfProperty (staticElement);
147- } else if (staticElement is ExecutableElement ) {
148- staticType = staticElement.type;
149- } else if (staticElement is VariableElement ) {
150- staticType = staticElement.type;
151- }
152-
153- staticType =
154- _inferenceHelper.inferTearOff (node, node.identifier, staticType);
155-
156- _recordStaticType (prefixedIdentifier, staticType);
157- _recordStaticType (node, staticType);
158- }
159-
160156 /// TODO(scheglov) this is duplicate
161157 void _setExtensionIdentifierType (Identifier node) {
162158 if (node is SimpleIdentifier && node.inDeclarationContext ()) {
0 commit comments