OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be | 5 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be |
6 // refactored to fit into analyzer. | 6 // refactored to fit into analyzer. |
7 library analyzer.src.task.strong.checker; | 7 library analyzer.src.task.strong.checker; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 | 576 |
577 @override | 577 @override |
578 void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { | 578 void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { |
579 checkFunctionApplication(node, node.function, node.argumentList); | 579 checkFunctionApplication(node, node.function, node.argumentList); |
580 node.visitChildren(this); | 580 node.visitChildren(this); |
581 } | 581 } |
582 | 582 |
583 @override | 583 @override |
584 void visitRedirectingConstructorInvocation( | 584 void visitRedirectingConstructorInvocation( |
585 RedirectingConstructorInvocation node) { | 585 RedirectingConstructorInvocation node) { |
586 var type = node.staticElement.type; | 586 var type = node.staticElement?.type; |
587 checkArgumentList(node.argumentList, type); | 587 // TODO(leafp): There's a TODO in visitRedirectingConstructorInvocation |
| 588 // in the element_resolver to handle the case that the element is null |
| 589 // and emit an error. In the meantime, just be defensive here. |
| 590 if (type != null) { |
| 591 checkArgumentList(node.argumentList, type); |
| 592 } |
588 node.visitChildren(this); | 593 node.visitChildren(this); |
589 } | 594 } |
590 | 595 |
591 @override | 596 @override |
592 void visitSuperConstructorInvocation(SuperConstructorInvocation node) { | 597 void visitSuperConstructorInvocation(SuperConstructorInvocation node) { |
593 var element = node.staticElement; | 598 var element = node.staticElement; |
594 if (element != null) { | 599 if (element != null) { |
595 var type = node.staticElement.type; | 600 var type = node.staticElement.type; |
596 checkArgumentList(node.argumentList, type); | 601 checkArgumentList(node.argumentList, type); |
597 } | 602 } |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 } | 1042 } |
1038 } catch (e) { | 1043 } catch (e) { |
1039 // TODO(sigmund): remove this try-catch block (see issue #48). | 1044 // TODO(sigmund): remove this try-catch block (see issue #48). |
1040 } | 1045 } |
1041 if (baseMethod == null || baseMethod.isStatic) return null; | 1046 if (baseMethod == null || baseMethod.isStatic) return null; |
1042 return baseMethod.type; | 1047 return baseMethod.type; |
1043 } | 1048 } |
1044 ; | 1049 ; |
1045 return f; | 1050 return f; |
1046 } | 1051 } |
OLD | NEW |