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

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

Issue 2886443003: Minor type inference fixes. (Closed)
Patch Set: Created 3 years, 7 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
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 5af584a6e371183142e3347f19991fa7d8647b01..e7f019c6b0268907931b61eddc11eef648902d26 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
@@ -353,7 +353,7 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> {
List<DartType> formalTypesFromContext =
new List<DartType>.filled(formals.length, null);
DartType returnContext;
- if (typeContext is FunctionType) {
+ if (strongMode && typeContext is FunctionType) {
for (int i = 0; i < formals.length; i++) {
if (i < function.positionalParameters.length) {
formalTypesFromContext[i] =
@@ -392,8 +392,11 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> {
KernelVariableDeclaration formal = formals[i];
if (KernelVariableDeclaration.isImplicitlyTyped(formal)) {
if (formalTypesFromContext[i] != null) {
- formal.type = greatestClosure(coreTypes,
+ var inferredType = greatestClosure(coreTypes,
substitution.substituteType(formalTypesFromContext[i]));
+ instrumentation?.record(Uri.parse(uri), formal.fileOffset, 'type',
+ new InstrumentationValueForType(inferredType));
+ formal.type = inferredType;
}
}
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart ('k') | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698