Handle nullable metrics on compiler tasks.
Some tasks have nullable metrics (e.g. https://github.com/dart-lang/sdk/blob/main/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart#L61) and so we should just skip processing those tasks.
Change-Id: Ie1f4e1042ef4b5d4a95a76085c37da088e885369
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255160
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
index 923e556..f94382d 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
@@ -58,7 +58,7 @@
final Compiler _compiler;
final GlobalLocalsMap _globalLocalsMap;
final InferredDataBuilder _inferredDataBuilder;
- Metrics /*?*/ _metrics;
+ Metrics _metrics = Metrics.none();
TypeGraphInferrer(this._compiler, this.closedWorld, this._globalLocalsMap,
this._inferredDataBuilder);
diff --git a/pkg/compiler/lib/src/inferrer/types.dart b/pkg/compiler/lib/src/inferrer/types.dart
index 8705fb2..53f87234 100644
--- a/pkg/compiler/lib/src/inferrer/types.dart
+++ b/pkg/compiler/lib/src/inferrer/types.dart
@@ -169,7 +169,7 @@
GlobalTypeInferenceResults resultsForTesting;
- Metrics _metrics;
+ Metrics _metrics = Metrics.none();
GlobalTypeInferenceTask(Compiler compiler)
: compiler = compiler,
@@ -189,7 +189,6 @@
if (compiler.disableTypeInference) {
results =
TrivialGlobalTypeInferenceResults(closedWorld, globalLocalsMap);
- _metrics = Metrics.none();
} else {
typesInferrerInternal ??= compiler.backendStrategy.createTypesInferrer(
closedWorld, globalLocalsMap, inferredDataBuilder);