Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 2779003004: Don't disable downward inference inside initializers used for top-level inference. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3746 matching lines...) Expand 10 before | Expand all | Expand 10 after
3757 Expression initializer = declaration.initializer; 3757 Expression initializer = declaration.initializer;
3758 3758
3759 DartType newType; 3759 DartType newType;
3760 if (!isValidForTypeInference(initializer)) { 3760 if (!isValidForTypeInference(initializer)) {
3761 newType = typeProvider.dynamicType; 3761 newType = typeProvider.dynamicType;
3762 } else { 3762 } else {
3763 ResolutionContext resolutionContext = 3763 ResolutionContext resolutionContext =
3764 ResolutionContextBuilder.contextFor(initializer); 3764 ResolutionContextBuilder.contextFor(initializer);
3765 ResolverVisitor visitor = new ResolverVisitor( 3765 ResolverVisitor visitor = new ResolverVisitor(
3766 variable.library, variable.source, typeProvider, errorListener, 3766 variable.library, variable.source, typeProvider, errorListener,
3767 nameScope: resolutionContext.scope, isTopLevelInference: true); 3767 nameScope: resolutionContext.scope);
3768 if (resolutionContext.enclosingClassDeclaration != null) { 3768 if (resolutionContext.enclosingClassDeclaration != null) {
3769 visitor.prepareToResolveMembersInClass( 3769 visitor.prepareToResolveMembersInClass(
3770 resolutionContext.enclosingClassDeclaration); 3770 resolutionContext.enclosingClassDeclaration);
3771 } 3771 }
3772 visitor.initForIncrementalResolution(); 3772 visitor.initForIncrementalResolution();
3773 initializer.accept(visitor); 3773 initializer.accept(visitor);
3774 newType = initializer.staticType; 3774 newType = initializer.staticType;
3775 if (newType == null || newType.isBottom || newType.isDartCoreNull) { 3775 if (newType == null || newType.isBottom || newType.isDartCoreNull) {
3776 newType = typeProvider.dynamicType; 3776 newType = typeProvider.dynamicType;
3777 } 3777 }
(...skipping 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after
6587 6587
6588 @override 6588 @override
6589 bool moveNext() { 6589 bool moveNext() {
6590 if (_newSources.isEmpty) { 6590 if (_newSources.isEmpty) {
6591 return false; 6591 return false;
6592 } 6592 }
6593 currentTarget = _newSources.removeLast(); 6593 currentTarget = _newSources.removeLast();
6594 return true; 6594 return true;
6595 } 6595 }
6596 } 6596 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | pkg/analyzer/test/src/summary/top_level_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698