@@ -225,7 +225,11 @@ class FunctionReferenceResolver {
225
225
// Continue to resolve type.
226
226
}
227
227
228
- // TODO(srawlins): If PropertyAccessorElement, report error.
228
+ if (member is PropertyAccessorElement ) {
229
+ function.accept (_resolver);
230
+ _resolveDisallowedExpression (node, member.returnType);
231
+ return ;
232
+ }
229
233
230
234
_resolve (node: node, rawType: member.type, name: propertyName.name);
231
235
}
@@ -298,9 +302,11 @@ class FunctionReferenceResolver {
298
302
return ;
299
303
}
300
304
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
+ }
304
310
305
311
function.accept (_resolver);
306
312
node.staticType = DynamicTypeImpl .instance;
@@ -388,8 +394,6 @@ class FunctionReferenceResolver {
388
394
PrefixedIdentifier prefix,
389
395
Element element,
390
396
) {
391
- // TODO(srawlins): Handle `loadLibrary`, as in `p.loadLibrary<int>;`.
392
-
393
397
if (element is MultiplyDefinedElement ) {
394
398
MultiplyDefinedElement multiply = element;
395
399
element = multiply.conflictingElements[0 ];
@@ -472,17 +476,25 @@ class FunctionReferenceResolver {
472
476
// Continue to assign types.
473
477
}
474
478
479
+ if (method is PropertyAccessorElement ) {
480
+ _resolveDisallowedExpression (node, method.returnType);
481
+ return ;
482
+ }
483
+
475
484
function.staticElement = method;
476
485
function.staticType = method.type;
477
486
_resolve (node: node, rawType: method.type, name: function.name);
478
487
return ;
479
488
} 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;
481
496
return ;
482
497
}
483
-
484
- // TODO(srawlins): if `(target is PropertyAccessorElement)`, report an
485
- // error.
486
498
}
487
499
488
500
// Classes and type aliases are checked first so as to include a
@@ -504,18 +516,34 @@ class FunctionReferenceResolver {
504
516
_resolveTypeAlias (node: node, element: element, typeAlias: function);
505
517
return ;
506
518
}
507
- } else if (element is ExecutableElement ) {
519
+ } else if (element is MethodElement ) {
508
520
function.staticElement = element;
509
521
function.staticType = element.type;
510
522
_resolve (node: node, rawType: element.type, name: element.name);
511
523
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 ;
512
539
} else if (element is VariableElement ) {
513
540
function.staticElement = element;
514
541
function.staticType = element.type;
515
542
_resolveDisallowedExpression (node, element.type);
516
543
return ;
517
544
} else {
518
- node.staticType = DynamicTypeImpl .instance;
545
+ _resolveDisallowedExpression (node, DynamicTypeImpl .instance);
546
+ return ;
519
547
}
520
548
}
521
549
0 commit comments