| Index: pkg/analyzer/lib/src/generated/resolver.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
|
| index d74e92556dc052cd46a05a82d54d74cd78e05994..debc3c3ecb604e1cbdee74da59e24142858eca2d 100644
|
| --- a/pkg/analyzer/lib/src/generated/resolver.dart
|
| +++ b/pkg/analyzer/lib/src/generated/resolver.dart
|
| @@ -30,8 +30,6 @@ import 'package:analyzer/src/generated/source.dart';
|
| import 'package:analyzer/src/generated/static_type_analyzer.dart';
|
| import 'package:analyzer/src/generated/type_system.dart';
|
| import 'package:analyzer/src/generated/utilities_dart.dart';
|
| -import 'package:analyzer/src/task/strong/info.dart'
|
| - show InferredType, StaticInfo;
|
|
|
| export 'package:analyzer/src/dart/resolver/inheritance_manager.dart';
|
| export 'package:analyzer/src/dart/resolver/scope.dart';
|
| @@ -4642,7 +4640,7 @@ class InferenceContext {
|
| /**
|
| * The error listener on which to record inference information.
|
| */
|
| - final AnalysisErrorListener _errorListener;
|
| + final ErrorReporter _errorReporter;
|
|
|
| /**
|
| * If true, emit hints when types are inferred
|
| @@ -4675,7 +4673,7 @@ class InferenceContext {
|
| // https://github.com/dart-lang/sdk/issues/25322
|
| final List<DartType> _returnStack = <DartType>[];
|
|
|
| - InferenceContext._(this._errorListener, TypeProvider typeProvider,
|
| + InferenceContext._(this._errorReporter, TypeProvider typeProvider,
|
| this._typeSystem, this._inferenceHints)
|
| : _typeProvider = typeProvider;
|
|
|
| @@ -4754,12 +4752,22 @@ class InferenceContext {
|
| * [type] has been inferred as the type of [node].
|
| */
|
| void recordInference(Expression node, DartType type) {
|
| - StaticInfo info = InferredType.create(_typeSystem, node, type);
|
| - if (!_inferenceHints || info == null) {
|
| + if (!_inferenceHints) {
|
| return;
|
| }
|
| - AnalysisError error = info.toAnalysisError();
|
| - _errorListener.onError(error);
|
| +
|
| + ErrorCode error;
|
| + if (node is Literal) {
|
| + error = StrongModeCode.INFERRED_TYPE_LITERAL;
|
| + } else if (node is InstanceCreationExpression) {
|
| + error = StrongModeCode.INFERRED_TYPE_ALLOCATION;
|
| + } else if (node is FunctionExpression) {
|
| + error = StrongModeCode.INFERRED_TYPE_CLOSURE;
|
| + } else {
|
| + error = StrongModeCode.INFERRED_TYPE;
|
| + }
|
| +
|
| + _errorReporter.reportErrorForNode(error, node, [node, type]);
|
| }
|
|
|
| List<DartType> _matchTypes(InterfaceType t1, InterfaceType t2) {
|
| @@ -5573,7 +5581,7 @@ class ResolverVisitor extends ScopedVisitor {
|
| strongModeHints = options.strongModeHints;
|
| }
|
| this.inferenceContext = new InferenceContext._(
|
| - errorListener, typeProvider, typeSystem, strongModeHints);
|
| + errorReporter, typeProvider, typeSystem, strongModeHints);
|
| this.typeAnalyzer = new StaticTypeAnalyzer(this);
|
| }
|
|
|
|
|