| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.generated.resolver; | 5 library analyzer.src.generated.resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 7165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7176 } | 7176 } |
| 7177 | 7177 |
| 7178 InferenceContext.setType(node.argumentList, contextType); | 7178 InferenceContext.setType(node.argumentList, contextType); |
| 7179 } | 7179 } |
| 7180 } | 7180 } |
| 7181 | 7181 |
| 7182 void _inferFormalParameterList(FormalParameterList node, DartType type) { | 7182 void _inferFormalParameterList(FormalParameterList node, DartType type) { |
| 7183 if (typeAnalyzer.inferFormalParameterList(node, type)) { | 7183 if (typeAnalyzer.inferFormalParameterList(node, type)) { |
| 7184 // TODO(leafp): This gets dropped on the floor if we're in the field | 7184 // TODO(leafp): This gets dropped on the floor if we're in the field |
| 7185 // inference task. We should probably keep these infos. | 7185 // inference task. We should probably keep these infos. |
| 7186 // |
| 7187 // TODO(jmesserly): this is reporting the context type, and therefore not |
| 7188 // necessarily the correct inferred type for the lambda. |
| 7189 // |
| 7190 // For example, `([x]) {}` could be passed to `int -> void` but its type |
| 7191 // will really be `([int]) -> void`. Similar issue for named arguments. |
| 7192 // It can also happen if the return type is inferred later on to be |
| 7193 // more precise. |
| 7194 // |
| 7195 // This reporting bug defeats the deduplication of error messages and |
| 7196 // results in the same inference message being reported twice. |
| 7197 // |
| 7198 // To get this right, we'd have to delay reporting until we have the |
| 7199 // complete type including return type. |
| 7186 inferenceContext.recordInference(node.parent, type); | 7200 inferenceContext.recordInference(node.parent, type); |
| 7187 } | 7201 } |
| 7188 } | 7202 } |
| 7189 | 7203 |
| 7190 /** | 7204 /** |
| 7191 * If given "mayBeClosure" is [FunctionExpression] without explicit parameters
types and its | 7205 * If given "mayBeClosure" is [FunctionExpression] without explicit parameters
types and its |
| 7192 * required type is [FunctionType], then infer parameters types from [Function
Type]. | 7206 * required type is [FunctionType], then infer parameters types from [Function
Type]. |
| 7193 */ | 7207 */ |
| 7194 void _inferFunctionExpressionParametersTypes( | 7208 void _inferFunctionExpressionParametersTypes( |
| 7195 Expression mayBeClosure, DartType mayByFunctionType) { | 7209 Expression mayBeClosure, DartType mayByFunctionType) { |
| (...skipping 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11005 return null; | 11019 return null; |
| 11006 } | 11020 } |
| 11007 if (identical(node.staticElement, variable)) { | 11021 if (identical(node.staticElement, variable)) { |
| 11008 if (node.inSetterContext()) { | 11022 if (node.inSetterContext()) { |
| 11009 result = true; | 11023 result = true; |
| 11010 } | 11024 } |
| 11011 } | 11025 } |
| 11012 return null; | 11026 return null; |
| 11013 } | 11027 } |
| 11014 } | 11028 } |
| OLD | NEW |