| 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 library dev_compiler.src.checker.checker; | 5 library dev_compiler.src.checker.checker; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; | 10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 if (arg is NamedExpression) { | 498 if (arg is NamedExpression) { |
| 499 arg.expression = checkAssignment(arg.expression, expectedType); | 499 arg.expression = checkAssignment(arg.expression, expectedType); |
| 500 return arg; | 500 return arg; |
| 501 } | 501 } |
| 502 return checkAssignment(arg, expectedType); | 502 return checkAssignment(arg, expectedType); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void checkFunctionApplication( | 505 void checkFunctionApplication( |
| 506 Expression node, Expression f, ArgumentList list) { | 506 Expression node, Expression f, ArgumentList list) { |
| 507 if (_rules.isDynamicCall(f)) { | 507 if (_rules.isDynamicCall(f)) { |
| 508 // TODO(vsm): For a function object, we should still be able to derive a | 508 // If f is Function and this is a method invocation, we should have |
| 509 // function type from it. | 509 // gotten an analyzer error, so no need to issue another error. |
| 510 _recordDynamicInvoke(node); | 510 _recordDynamicInvoke(node); |
| 511 } else { | 511 } else { |
| 512 checkArgumentList(list, _rules.getStaticType(f)); | 512 checkArgumentList(list, _rules.getTypeAsCaller(f)); |
| 513 } | 513 } |
| 514 } | 514 } |
| 515 | 515 |
| 516 visitMethodInvocation(MethodInvocation node) { | 516 visitMethodInvocation(MethodInvocation node) { |
| 517 checkFunctionApplication(node, node.methodName, node.argumentList); | 517 checkFunctionApplication(node, node.methodName, node.argumentList); |
| 518 node.visitChildren(this); | 518 node.visitChildren(this); |
| 519 } | 519 } |
| 520 | 520 |
| 521 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { | 521 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { |
| 522 checkFunctionApplication(node, node.function, node.argumentList); | 522 checkFunctionApplication(node, node.function, node.argumentList); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 void _recordDynamicInvoke(AstNode node) { | 797 void _recordDynamicInvoke(AstNode node) { |
| 798 _reporter.log(new DynamicInvoke(_rules, node)); | 798 _reporter.log(new DynamicInvoke(_rules, node)); |
| 799 } | 799 } |
| 800 | 800 |
| 801 void _recordMessage(StaticInfo info) { | 801 void _recordMessage(StaticInfo info) { |
| 802 if (info == null) return; | 802 if (info == null) return; |
| 803 if (info.level >= logger.Level.SEVERE) _failure = true; | 803 if (info.level >= logger.Level.SEVERE) _failure = true; |
| 804 _reporter.log(info); | 804 _reporter.log(info); |
| 805 } | 805 } |
| 806 } | 806 } |
| OLD | NEW |