mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 20:51:50 +00:00
[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>
This commit is contained in:
parent
daa7e57d45
commit
de0679ac99
|
@ -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 @@ class FunctionInlineCache {
|
|||
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 @@ class FunctionInlineCache {
|
|||
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 @@ class FunctionInlineCache {
|
|||
|
||||
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;
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue