Skip to content

Commit 9f6510b

Browse files
fishythefishcommit-bot@chromium.org
authored andcommitted
[dart2js] Replace accesses to options.nullSafetyMode with
`options.useLegacySubtyping` where possible. Change-Id: I462044e536f061cc0c67b044b986494801f58e1b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150765 Reviewed-by: Sigmund Cherem <[email protected]> Commit-Queue: Mayank Patke <[email protected]>
1 parent 6b40b26 commit 9f6510b

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

pkg/compiler/lib/src/js_model/element_map_impl.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,9 +1184,9 @@ class JsKernelToElementMap implements JsToElementMap, IrToElementMap {
11841184
environment: _environment.toMap(),
11851185
enableTripleShift:
11861186
options.languageExperiments[ir.ExperimentalFlag.tripleShift],
1187-
evaluationMode: options.nullSafetyMode == NullSafetyMode.sound
1188-
? ir.EvaluationMode.strong
1189-
: ir.EvaluationMode.weak);
1187+
evaluationMode: options.useLegacySubtyping
1188+
? ir.EvaluationMode.weak
1189+
: ir.EvaluationMode.strong);
11901190
}
11911191

11921192
@override

pkg/compiler/lib/src/kernel/element_map_impl.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,9 +818,9 @@ class KernelToElementMapImpl implements KernelToElementMap, IrToElementMap {
818818
environment: _environment.toMap(),
819819
enableTripleShift:
820820
options.languageExperiments[ir.ExperimentalFlag.tripleShift],
821-
evaluationMode: options.nullSafetyMode == NullSafetyMode.sound
822-
? ir.EvaluationMode.strong
823-
: ir.EvaluationMode.weak);
821+
evaluationMode: options.useLegacySubtyping
822+
? ir.EvaluationMode.weak
823+
: ir.EvaluationMode.strong);
824824
}
825825

826826
@override

pkg/compiler/lib/src/kernel/loader.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class KernelLoaderTask extends CompilerTask {
6464
// We defer selecting the platform until we've resolved the NNBD mode.
6565
String getPlatformFilename() {
6666
String platform = targetName;
67-
if ((_options.nullSafetyMode == NullSafetyMode.sound)) {
67+
if (!_options.useLegacySubtyping) {
6868
platform += "_nnbd_strong";
6969
}
7070
platform += "_platform.dill";

pkg/compiler/lib/src/options.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ class CompilerOptions implements DiagnosticOptions {
350350
/// unsound or sound semantics.
351351
///
352352
/// If unspecified, the mode must be inferred from the entrypoint.
353+
///
354+
/// This option should rarely need to be accessed directly. Consider using
355+
/// [useLegacySubtyping] instead.
353356
NullSafetyMode nullSafetyMode = NullSafetyMode.unspecified;
354357
bool _soundNullSafety = false;
355358
bool _noSoundNullSafety = false;

pkg/compiler/test/model/cfe_constant_evaluation_test.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import 'package:compiler/src/ir/constants.dart';
2020
import 'package:compiler/src/ir/visitors.dart';
2121
import 'package:compiler/src/kernel/kernel_strategy.dart';
2222
import 'package:compiler/src/kernel/element_map_impl.dart';
23-
import 'package:compiler/src/options.dart';
2423
import 'package:front_end/src/api_prototype/constant_evaluator.dart' as ir;
2524
import 'package:front_end/src/api_unstable/dart2js.dart' as ir;
2625
import 'package:kernel/ast.dart' as ir;
@@ -691,10 +690,9 @@ Future testData(TestData data) async {
691690
},
692691
environment: environment,
693692
supportReevaluationForTesting: true,
694-
evaluationMode:
695-
compiler.options.nullSafetyMode == NullSafetyMode.sound
696-
? ir.EvaluationMode.strong
697-
: ir.EvaluationMode.weak);
693+
evaluationMode: compiler.options.useLegacySubtyping
694+
? ir.EvaluationMode.weak
695+
: ir.EvaluationMode.strong);
698696
ir.Constant evaluatedConstant = evaluator.evaluate(
699697
new ir.StaticTypeContext(node, typeEnvironment), initializer);
700698

0 commit comments

Comments
 (0)