Chromium Code Reviews| 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 /// Encapsulates how to invoke the analyzer resolver and overrides how it | 5 /// Encapsulates how to invoke the analyzer resolver and overrides how it |
| 6 /// computes types on expressions to use our restricted set of types. | 6 /// computes types on expressions to use our restricted set of types. |
| 7 library dev_compiler.src.checker.resolver; | 7 library dev_compiler.src.checker.resolver; |
| 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 655 ]; | 655 ]; |
| 656 } | 656 } |
| 657 | 657 |
| 658 var targetType = node.target?.staticType; | 658 var targetType = node.target?.staticType; |
| 659 var arguments = node.argumentList.arguments; | 659 var arguments = node.argumentList.arguments; |
| 660 | 660 |
| 661 for (var generic in _genericList) { | 661 for (var generic in _genericList) { |
| 662 if (e?.name == generic[1]) { | 662 if (e?.name == generic[1]) { |
| 663 if ((generic[0] is String && | 663 if ((generic[0] is String && |
| 664 element?.library.source.uri.toString() == generic[0]) || | 664 element?.library.source.uri.toString() == generic[0]) || |
| 665 (targetType == generic[0] || | 665 (generic[0] is DartType && |
|
vsm
2015/09/02 19:14:32
We were accidentally calling isSubtypeOf with a St
Leaf
2015/09/02 20:34:03
youch.
| |
| 666 targetType != null && targetType.isSubtypeOf(generic[0]))) { | 666 targetType != null && |
| 667 targetType.isSubtypeOf(generic[0]))) { | |
| 667 if (arguments.length == generic[2]) { | 668 if (arguments.length == generic[2]) { |
| 668 return Function.apply( | 669 return Function.apply( |
| 669 generic[3], arguments.map((arg) => arg.staticType).toList()); | 670 generic[3], arguments.map((arg) => arg.staticType).toList()); |
| 670 } | 671 } |
| 671 } | 672 } |
| 672 } | 673 } |
| 673 } | 674 } |
| 674 | 675 |
| 675 return null; | 676 return null; |
| 676 } | 677 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 800 } | 801 } |
| 801 } | 802 } |
| 802 | 803 |
| 803 // Review note: no longer need to override visitFunctionExpression, this is | 804 // Review note: no longer need to override visitFunctionExpression, this is |
| 804 // handled by the analyzer internally. | 805 // handled by the analyzer internally. |
| 805 // TODO(vsm): in visitbinaryExpression: check computeStaticReturnType result? | 806 // TODO(vsm): in visitbinaryExpression: check computeStaticReturnType result? |
| 806 // TODO(vsm): in visitFunctionDeclaration: Should we ever use the expression | 807 // TODO(vsm): in visitFunctionDeclaration: Should we ever use the expression |
| 807 // type in a (...) => expr or just the written type? | 808 // type in a (...) => expr or just the written type? |
| 808 | 809 |
| 809 } | 810 } |
| OLD | NEW |