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

Unified Diff: pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart

Issue 2829683008: Use a non-null TypeInferrer even in non-strong mode. (Closed)
Patch Set: Created 3 years, 8 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/front_end/lib/src/fasta/source/source_loader.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index bc24dcea0830f92471b7f1c0f20bf8de172c3fbd..b7fc20688edb94a371bcabb89d8b83f0fb15c2a6 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -23,11 +23,14 @@ abstract class TypeInferrer<S, E, V, F> {
final Instrumentation instrumentation;
+ final bool strongMode;
+
/// The URI of the code for which type inference is currently being
/// performed--this is used for testing.
Uri uri;
- TypeInferrer(this.coreTypes, this.classHierarchy, this.instrumentation);
+ TypeInferrer(this.coreTypes, this.classHierarchy, this.instrumentation,
+ this.strongMode);
/// Performs type inference on a method with the given method [body].
///
@@ -75,7 +78,7 @@ abstract class TypeInferrer<S, E, V, F> {
if (initializer == null) return;
var inferredType =
inferExpression(initializer, declaredType, declaredType == null);
- if (declaredType == null) {
+ if (strongMode && declaredType == null) {
instrumentation?.record(
'type', uri, offset, new InstrumentationValueForType(inferredType));
setType(inferredType);
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/source_loader.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698