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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 2062793003: Revert "Revert "Refactor strong mode to use standard Analyzer errors"" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/lib/src/generated/type_system.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 48aeaaffb8735dad8acfb9961065ad7f0ca37082..ca02438d7ee4fb47d33baf18f7a934a0e4910bd9 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';
@@ -4646,7 +4644,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
@@ -4679,7 +4677,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;
@@ -4758,12 +4756,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) {
@@ -5577,7 +5585,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);
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/lib/src/generated/type_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698