Skip to content

Commit f4bcc6d

Browse files
johnniwintherCommit Bot
authored and
Commit Bot
committed
[cfe] Reuse InferenceVisitor on recursive calls
This moves inferExpression and inferStatement from TypeInferrer to InferenceVisitor and reuses the visitor throughout the inference. Change-Id: Ieea1084a51998f8f5f351d7cdecf5b907108971e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247969 Reviewed-by: Chloe Stefantsova <[email protected]> Commit-Queue: Johnni Winther <[email protected]>
1 parent ba4b3d2 commit f4bcc6d

File tree

5 files changed

+634
-578
lines changed

5 files changed

+634
-578
lines changed

pkg/front_end/lib/src/fasta/kernel/benchmarker.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,14 @@ enum BenchmarkSubdivides {
236236

237237
inferConstructorParameterTypes,
238238
inferDeclarationType,
239-
inferExpression,
239+
inferImplicitFieldType,
240240
inferFieldInitializer,
241241
inferFunctionBody,
242242
inferInitializer,
243243
inferMetadata,
244244
inferMetadataKeepingHelper,
245245
inferParameterInitializer,
246-
inferInvocation,
246+
inferRedirectingFactoryTypeArguments,
247247

248248
buildOutlineExpressions,
249249
delayedActionPerformer,

pkg/front_end/lib/src/fasta/kernel/implicit_field_type.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import '../problems.dart' show unsupported;
1717
import '../builder/builder.dart';
1818
import '../source/source_field_builder.dart';
1919
import '../type_inference/type_inferrer.dart';
20-
import '../type_inference/type_schema.dart';
2120
import 'body_builder.dart';
2221

2322
abstract class ImplicitFieldType extends DartType {
@@ -162,10 +161,7 @@ class _ImplicitFieldTypeRoot extends ImplicitFieldType {
162161
bodyBuilder.parseFieldInitializer(initializerToken!);
163162
initializerToken = null;
164163

165-
ExpressionInferenceResult result = typeInferrer.inferExpression(
166-
initializer, const UnknownType(), true,
167-
isVoidAllowed: true);
168-
inferredType = typeInferrer.inferDeclarationType(result.inferredType);
164+
inferredType = typeInferrer.inferImplicitFieldType(initializer);
169165
} else {
170166
inferredType = const DynamicType();
171167
}

0 commit comments

Comments
 (0)