| 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/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 | 978 |
| 979 /// Given an expression, return its type assuming it is | 979 /// Given an expression, return its type assuming it is |
| 980 /// in the caller position of a call (that is, accounting | 980 /// in the caller position of a call (that is, accounting |
| 981 /// for the possibility of a call method). Returns null | 981 /// for the possibility of a call method). Returns null |
| 982 /// if expression is not statically callable. | 982 /// if expression is not statically callable. |
| 983 FunctionType _getTypeAsCaller(InvocationExpression node) { | 983 FunctionType _getTypeAsCaller(InvocationExpression node) { |
| 984 DartType type = node.staticInvokeType; | 984 DartType type = node.staticInvokeType; |
| 985 if (type is FunctionType) { | 985 if (type is FunctionType) { |
| 986 return type; | 986 return type; |
| 987 } else if (type is InterfaceType) { | 987 } else if (type is InterfaceType) { |
| 988 return rules.getCallMethodType(type); | 988 return rules.getCallMethodDefiniteType(type); |
| 989 } | 989 } |
| 990 return null; | 990 return null; |
| 991 } | 991 } |
| 992 | 992 |
| 993 /// Returns `true` if the expression is a dynamic function call or method | 993 /// Returns `true` if the expression is a dynamic function call or method |
| 994 /// invocation. | 994 /// invocation. |
| 995 bool _isDynamicCall(InvocationExpression call, FunctionType ft) { | 995 bool _isDynamicCall(InvocationExpression call, FunctionType ft) { |
| 996 // TODO(leafp): This will currently return true if t is Function | 996 // TODO(leafp): This will currently return true if t is Function |
| 997 // This is probably the most correct thing to do for now, since | 997 // This is probably the most correct thing to do for now, since |
| 998 // this code is also used by the back end. Maybe revisit at some | 998 // this code is also used by the back end. Maybe revisit at some |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 var visited = new Set<InterfaceType>(); | 1500 var visited = new Set<InterfaceType>(); |
| 1501 do { | 1501 do { |
| 1502 visited.add(current); | 1502 visited.add(current); |
| 1503 current.mixins.reversed.forEach( | 1503 current.mixins.reversed.forEach( |
| 1504 (m) => _checkIndividualOverridesFromClass(node, m, seen, true)); | 1504 (m) => _checkIndividualOverridesFromClass(node, m, seen, true)); |
| 1505 _checkIndividualOverridesFromClass(node, current.superclass, seen, true); | 1505 _checkIndividualOverridesFromClass(node, current.superclass, seen, true); |
| 1506 current = current.superclass; | 1506 current = current.superclass; |
| 1507 } while (!current.isObject && !visited.contains(current)); | 1507 } while (!current.isObject && !visited.contains(current)); |
| 1508 } | 1508 } |
| 1509 } | 1509 } |
| OLD | NEW |