| 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 f32871be67d8b8fe8cadbcc3f636a7293b193f93..b92f4300484ed0b18d2b00f8827b0c04e0dd218f 100644
|
| --- a/pkg/analyzer/lib/src/task/dart.dart
|
| +++ b/pkg/analyzer/lib/src/task/dart.dart
|
| @@ -3155,36 +3155,13 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask {
|
| TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
|
|
|
| //
|
| - // Prepare fields for which inference should be disabled.
|
| - //
|
| - Set<FieldElement> fieldsWithDisabledInference = new Set<FieldElement>();
|
| - for (CompilationUnitMember classDeclaration in unit.declarations) {
|
| - if (classDeclaration is ClassDeclaration) {
|
| - for (ClassMember fieldDeclaration in classDeclaration.members) {
|
| - if (fieldDeclaration is FieldDeclaration) {
|
| - if (!fieldDeclaration.isStatic) {
|
| - for (VariableDeclaration field
|
| - in fieldDeclaration.fields.variables) {
|
| - Expression initializer = field.initializer;
|
| - if (initializer != null &&
|
| - !isValidForTypeInference(initializer)) {
|
| - fieldsWithDisabledInference.add(field.element);
|
| - }
|
| - }
|
| - }
|
| - }
|
| - }
|
| - }
|
| - }
|
| -
|
| - //
|
| // Infer instance members.
|
| //
|
| if (context.analysisOptions.strongMode) {
|
| var inheritanceManager = new InheritanceManager(
|
| resolutionMap.elementDeclaredByCompilationUnit(unit).library);
|
| InstanceMemberInferrer inferrer = new InstanceMemberInferrer(
|
| - typeProvider, (_) => inheritanceManager, fieldsWithDisabledInference,
|
| + typeProvider, (_) => inheritanceManager,
|
| typeSystem: context.typeSystem);
|
| inferrer.inferCompilationUnit(unit.element);
|
| }
|
| @@ -3446,25 +3423,20 @@ class InferStaticVariableTypeTask extends InferStaticVariableTask {
|
| RecordingErrorListener errorListener = new RecordingErrorListener();
|
| Expression initializer = declaration.initializer;
|
|
|
| - DartType newType;
|
| - if (!isValidForTypeInference(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 = initializer.staticType;
|
| + if (newType == null || newType.isBottom || newType.isDartCoreNull) {
|
| newType = typeProvider.dynamicType;
|
| - } else {
|
| - 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);
|
| - newType = initializer.staticType;
|
| - if (newType == null || newType.isBottom || newType.isDartCoreNull) {
|
| - newType = typeProvider.dynamicType;
|
| - }
|
| }
|
|
|
| //
|
|
|