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/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
(...skipping 3727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3738 visitor.prepareToResolveMembersInClass( | 3738 visitor.prepareToResolveMembersInClass( |
3739 resolutionContext.enclosingClassDeclaration); | 3739 resolutionContext.enclosingClassDeclaration); |
3740 } | 3740 } |
3741 visitor.initForIncrementalResolution(); | 3741 visitor.initForIncrementalResolution(); |
3742 initializer.accept(visitor); | 3742 initializer.accept(visitor); |
3743 | 3743 |
3744 // | 3744 // |
3745 // Record the type of the variable. | 3745 // Record the type of the variable. |
3746 // | 3746 // |
3747 DartType newType = initializer.staticType; | 3747 DartType newType = initializer.staticType; |
3748 if (newType == null || newType.isBottom) { | 3748 if (newType == null || newType.isBottom || newType.isDartCoreNull) { |
3749 newType = typeProvider.dynamicType; | 3749 newType = typeProvider.dynamicType; |
3750 } | 3750 } |
3751 setFieldType(variable, newType); | 3751 setFieldType(variable, newType); |
3752 errors = getUniqueErrors(errorListener.errors); | 3752 errors = getUniqueErrors(errorListener.errors); |
3753 } else { | 3753 } else { |
3754 // TODO(brianwilkerson) For now we simply don't infer any type for | 3754 // TODO(brianwilkerson) For now we simply don't infer any type for |
3755 // variables or fields involved in a cycle. We could try to be smarter | 3755 // variables or fields involved in a cycle. We could try to be smarter |
3756 // by re-resolving the initializer in a context in which the types of all | 3756 // by re-resolving the initializer in a context in which the types of all |
3757 // of the variables in the cycle are assumed to be `null`, but it isn't | 3757 // of the variables in the cycle are assumed to be `null`, but it isn't |
3758 // clear to me that this would produce better results often enough to | 3758 // clear to me that this would produce better results often enough to |
(...skipping 2792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6551 | 6551 |
6552 @override | 6552 @override |
6553 bool moveNext() { | 6553 bool moveNext() { |
6554 if (_newSources.isEmpty) { | 6554 if (_newSources.isEmpty) { |
6555 return false; | 6555 return false; |
6556 } | 6556 } |
6557 currentTarget = _newSources.removeLast(); | 6557 currentTarget = _newSources.removeLast(); |
6558 return true; | 6558 return true; |
6559 } | 6559 } |
6560 } | 6560 } |
OLD | NEW |