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

Unified Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 2782533002: Report errors for the new top-level inference rules. (Closed)
Patch Set: Update language_strong status for analyzer. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/task/dart.dart
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index 4635f5542c68f754d0f2618d065837092fcae6f0..140ceb1de12ee26c7b236077905ade0d8d3136df 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -3755,22 +3755,22 @@ class InferStaticVariableTypeTask extends InferStaticVariableTask {
//
RecordingErrorListener errorListener = new RecordingErrorListener();
Expression initializer = declaration.initializer;
- ResolutionContext resolutionContext =
- ResolutionContextBuilder.contextFor(initializer);
- ResolverVisitor visitor = new ResolverVisitor(
- variable.library, variable.source, typeProvider, errorListener,
- nameScope: resolutionContext.scope);
- if (resolutionContext.enclosingClassDeclaration != null) {
- visitor.prepareToResolveMembersInClass(
- resolutionContext.enclosingClassDeclaration);
- }
- visitor.initForIncrementalResolution();
- initializer.accept(visitor);
DartType newType;
if (!isValidForTypeInference(initializer)) {
newType = typeProvider.dynamicType;
} else {
+ ResolutionContext resolutionContext =
+ ResolutionContextBuilder.contextFor(initializer);
+ ResolverVisitor visitor = new ResolverVisitor(
+ variable.library, variable.source, typeProvider, errorListener,
+ nameScope: resolutionContext.scope, isTopLevelInference: true);
+ if (resolutionContext.enclosingClassDeclaration != null) {
+ visitor.prepareToResolveMembersInClass(
+ resolutionContext.enclosingClassDeclaration);
+ }
+ visitor.initForIncrementalResolution();
+ initializer.accept(visitor);
newType = initializer.staticType;
if (newType == null || newType.isBottom || newType.isDartCoreNull) {
newType = typeProvider.dynamicType;
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698