@@ -225,7 +225,11 @@ class FunctionReferenceResolver {
225225 // Continue to resolve type.
226226 }
227227
228- // TODO(srawlins): If PropertyAccessorElement, report error.
228+ if (member is PropertyAccessorElement ) {
229+ function.accept (_resolver);
230+ _resolveDisallowedExpression (node, member.returnType);
231+ return ;
232+ }
229233
230234 _resolve (node: node, rawType: member.type, name: propertyName.name);
231235 }
@@ -298,9 +302,11 @@ class FunctionReferenceResolver {
298302 return ;
299303 }
300304
301- // TODO(srawlins): Need to report cases where [methodElement] is not
302- // generic. The 'test_instanceGetter_explicitReceiver' test case needs to
303- // be updated to handle this.
305+ if (methodElement is PropertyAccessorElement ) {
306+ function.accept (_resolver);
307+ _resolveDisallowedExpression (node, methodElement.returnType);
308+ return ;
309+ }
304310
305311 function.accept (_resolver);
306312 node.staticType = DynamicTypeImpl .instance;
@@ -388,8 +394,6 @@ class FunctionReferenceResolver {
388394 PrefixedIdentifier prefix,
389395 Element element,
390396 ) {
391- // TODO(srawlins): Handle `loadLibrary`, as in `p.loadLibrary<int>;`.
392-
393397 if (element is MultiplyDefinedElement ) {
394398 MultiplyDefinedElement multiply = element;
395399 element = multiply.conflictingElements[0 ];
@@ -472,17 +476,25 @@ class FunctionReferenceResolver {
472476 // Continue to assign types.
473477 }
474478
479+ if (method is PropertyAccessorElement ) {
480+ _resolveDisallowedExpression (node, method.returnType);
481+ return ;
482+ }
483+
475484 function.staticElement = method;
476485 function.staticType = method.type;
477486 _resolve (node: node, rawType: method.type, name: function.name);
478487 return ;
479488 } else {
480- // TODO(srawlins): Report CompileTimeErrorCode.UNDEFINED_METHOD.
489+ _resolver.errorReporter.reportErrorForNode (
490+ CompileTimeErrorCode .UNDEFINED_METHOD ,
491+ function,
492+ [function.name, enclosingClass],
493+ );
494+ function.staticType = DynamicTypeImpl .instance;
495+ node.staticType = DynamicTypeImpl .instance;
481496 return ;
482497 }
483-
484- // TODO(srawlins): if `(target is PropertyAccessorElement)`, report an
485- // error.
486498 }
487499
488500 // Classes and type aliases are checked first so as to include a
@@ -504,18 +516,34 @@ class FunctionReferenceResolver {
504516 _resolveTypeAlias (node: node, element: element, typeAlias: function);
505517 return ;
506518 }
507- } else if (element is ExecutableElement ) {
519+ } else if (element is MethodElement ) {
508520 function.staticElement = element;
509521 function.staticType = element.type;
510522 _resolve (node: node, rawType: element.type, name: element.name);
511523 return ;
524+ } else if (element is FunctionElement ) {
525+ function.staticElement = element;
526+ function.staticType = element.type;
527+ _resolve (node: node, rawType: element.type, name: element.name);
528+ return ;
529+ } else if (element is PropertyAccessorElement ) {
530+ function.staticElement = element;
531+ function.staticType = element.returnType;
532+ _resolveDisallowedExpression (node, element.returnType);
533+ return ;
534+ } else if (element is ExecutableElement ) {
535+ function.staticElement = element;
536+ function.staticType = element.type;
537+ _resolveDisallowedExpression (node, element.type);
538+ return ;
512539 } else if (element is VariableElement ) {
513540 function.staticElement = element;
514541 function.staticType = element.type;
515542 _resolveDisallowedExpression (node, element.type);
516543 return ;
517544 } else {
518- node.staticType = DynamicTypeImpl .instance;
545+ _resolveDisallowedExpression (node, DynamicTypeImpl .instance);
546+ return ;
519547 }
520548 }
521549
0 commit comments