| 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 analyzer.src.task.dart; | 5 library analyzer.src.task.dart; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 3197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3208 visitor.initForIncrementalResolution(); | 3208 visitor.initForIncrementalResolution(); |
| 3209 initializer.accept(visitor); | 3209 initializer.accept(visitor); |
| 3210 | 3210 |
| 3211 // | 3211 // |
| 3212 // Record the type of the variable. | 3212 // Record the type of the variable. |
| 3213 // | 3213 // |
| 3214 DartType newType = initializer.staticType; | 3214 DartType newType = initializer.staticType; |
| 3215 if (newType == null || newType.isBottom) { | 3215 if (newType == null || newType.isBottom) { |
| 3216 newType = typeProvider.dynamicType; | 3216 newType = typeProvider.dynamicType; |
| 3217 } | 3217 } |
| 3218 variable.type = newType; | 3218 setFieldType(variable, newType); |
| 3219 (variable.initializer as ExecutableElementImpl).returnType = newType; | |
| 3220 if (variable is PropertyInducingElementImpl) { | |
| 3221 setReturnType(variable.getter, newType); | |
| 3222 if (!variable.isFinal && !variable.isConst) { | |
| 3223 setParameterType(variable.setter, newType); | |
| 3224 } | |
| 3225 } | |
| 3226 } else { | 3219 } else { |
| 3227 // TODO(brianwilkerson) For now we simply don't infer any type for | 3220 // TODO(brianwilkerson) For now we simply don't infer any type for |
| 3228 // variables or fields involved in a cycle. We could try to be smarter | 3221 // variables or fields involved in a cycle. We could try to be smarter |
| 3229 // by re-resolving the initializer in a context in which the types of all | 3222 // by re-resolving the initializer in a context in which the types of all |
| 3230 // of the variables in the cycle are assumed to be `null`, but it isn't | 3223 // of the variables in the cycle are assumed to be `null`, but it isn't |
| 3231 // clear to me that this would produce better results often enough to | 3224 // clear to me that this would produce better results often enough to |
| 3232 // warrant the extra effort. | 3225 // warrant the extra effort. |
| 3233 } | 3226 } |
| 3234 // | 3227 // |
| 3235 // Record outputs. | 3228 // Record outputs. |
| (...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5444 | 5437 |
| 5445 @override | 5438 @override |
| 5446 bool moveNext() { | 5439 bool moveNext() { |
| 5447 if (_newSources.isEmpty) { | 5440 if (_newSources.isEmpty) { |
| 5448 return false; | 5441 return false; |
| 5449 } | 5442 } |
| 5450 currentTarget = _newSources.removeLast(); | 5443 currentTarget = _newSources.removeLast(); |
| 5451 return true; | 5444 return true; |
| 5452 } | 5445 } |
| 5453 } | 5446 } |
| OLD | NEW |