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

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

Issue 1498573002: Hide inference hints. Fixes #24563. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Move TODO Created 5 years 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/engine.dart ('k') | pkg/analyzer/test/generated/resolver_test.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 8ded6fd4c37bac714ef07b2dfa3be41023c3bae4..b80ed5a2deaca94429c70bb7a6759ea33bb33889 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -5772,6 +5772,11 @@ class InferenceContext {
final AnalysisErrorListener _errorListener;
/**
+ * If true, emit hints when types are inferred
+ */
+ final bool _inferenceHints;
+
+ /**
* Type provider, needed for type matching.
*/
final TypeProvider _typeProvider;
@@ -5792,8 +5797,8 @@ class InferenceContext {
*/
List<DartType> _returnStack = <DartType>[];
- InferenceContext._(
- this._errorListener, TypeProvider typeProvider, this._typeSystem)
+ InferenceContext._(this._errorListener, TypeProvider typeProvider,
+ this._typeSystem, this._inferenceHints)
: _typeProvider = typeProvider,
_rules = new TypeRules(typeProvider);
@@ -5837,7 +5842,7 @@ class InferenceContext {
*/
void recordInference(Expression node, DartType type) {
StaticInfo info = InferredType.create(_rules, node, type);
- if (info == null) {
+ if (!_inferenceHints || info == null) {
return;
}
AnalysisError error = info.toAnalysisError();
@@ -10695,8 +10700,13 @@ class ResolverVisitor extends ScopedVisitor {
}
this.elementResolver = new ElementResolver(this);
this.typeSystem = definingLibrary.context.typeSystem;
- this.inferenceContext =
- new InferenceContext._(errorListener, typeProvider, typeSystem);
+ bool strongModeHints = false;
+ AnalysisOptions options = definingLibrary.context.analysisOptions;
+ if (options is AnalysisOptionsImpl) {
+ strongModeHints = options.strongModeHints;
+ }
+ this.inferenceContext = new InferenceContext._(
+ errorListener, typeProvider, typeSystem, strongModeHints);
if (typeAnalyzerFactory == null) {
this.typeAnalyzer = new StaticTypeAnalyzer(this);
} else {
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698