[dart2js] Migrate js_backend/backend.dart to null safety. Change-Id: I6b38f996a8c9bf77343aba0f062e42d32d7b93ae Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268401 Reviewed-by: Mayank Patke <fishythefish@google.com>
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart index 0593bed..635095f 100644 --- a/pkg/compiler/lib/src/js_backend/backend.dart +++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -2,12 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.10 - library js_backend.backend; import '../common.dart'; -import '../common/codegen.dart'; +import '../common/codegen_interfaces.dart'; import '../elements/entities.dart'; import '../inferrer/types.dart'; import '../js_model/elements.dart'; @@ -55,17 +53,11 @@ return '$method'.startsWith(jsElementPrefix); } - /// Returns the current cache decision. This should only be used for testing. - int getCurrentCacheDecisionForTesting(FunctionEntity element) { - assert(checkFunction(element), failedAt(element)); - return _cachedDecisions[element]; - } - // Returns `true`/`false` if we have a cached decision. // Returns `null` otherwise. - bool canInline(FunctionEntity element, {bool insideLoop}) { + bool? canInline(FunctionEntity element, {required bool insideLoop}) { assert(checkFunction(element), failedAt(element)); - int decision = _cachedDecisions[element]; + int? decision = _cachedDecisions[element]; if (decision == null) { // TODO(sra): Have annotations for mustInline / noInline for constructor @@ -114,9 +106,9 @@ return null; } - void markAsInlinable(FunctionEntity element, {bool insideLoop}) { + void markAsInlinable(FunctionEntity element, {required bool insideLoop}) { assert(checkFunction(element), failedAt(element)); - int oldDecision = _cachedDecisions[element]; + int? oldDecision = _cachedDecisions[element]; if (oldDecision == null) { oldDecision = _unknown; @@ -170,7 +162,7 @@ void markAsNonInlinable(FunctionEntity element, {bool insideLoop = true}) { assert(checkFunction(element), failedAt(element)); - int oldDecision = _cachedDecisions[element]; + int? oldDecision = _cachedDecisions[element]; if (oldDecision == null) { oldDecision = _unknown;
diff --git a/pkg/compiler/lib/src/js_backend/js_backend.dart b/pkg/compiler/lib/src/js_backend/js_backend.dart index 65d066f..736e9c0 100644 --- a/pkg/compiler/lib/src/js_backend/js_backend.dart +++ b/pkg/compiler/lib/src/js_backend/js_backend.dart
@@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.10 - library js_backend; export 'backend.dart';