@@ -11,8 +11,6 @@ import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
1111import 'commandline_options.dart' show Flags;
1212import 'util/util.dart' ;
1313
14- enum NullSafetyMode { unsound, sound }
15-
1614enum FeatureStatus { shipped, shipping, canary }
1715
1816enum CompilerPhase {
@@ -534,13 +532,6 @@ class CompilerOptions implements DiagnosticOptions {
534532 /// Whether to generate code containing user's `assert` statements.
535533 bool enableUserAssertions = false ;
536534
537- /// Whether to generate code asserting that non-nullable parameters in opt-in
538- /// code are not null. In mixed mode code (some opting into non-nullable, some
539- /// not), null-safety is unsound, allowing `null` values to be assigned to
540- /// variables with non-nullable types. This assertion lets the opt-in code
541- /// operate with a stronger guarantee.
542- bool enableNullAssertions = false ;
543-
544535 /// Whether to generate code asserting that non-nullable return values of
545536 /// `@Native` methods or `JS()` invocations are checked for being non-null.
546537 /// Emits checks only in sound null-safety.
@@ -678,22 +669,10 @@ class CompilerOptions implements DiagnosticOptions {
678669 /// migrated to null safety (but before sound null safety is enabled).
679670 bool experimentNullSafetyChecks = false ;
680671
681- /// Whether the compiler should emit code with unsound or sound semantics.
682- /// Since Dart 3.0 this is no longer inferred from sources, but defaults to
683- /// sound semantics.
684- ///
685- /// This option should rarely need to be accessed directly. Consider using
686- /// [useLegacySubtyping] instead.
687- NullSafetyMode nullSafetyMode = NullSafetyMode .sound;
688- bool _soundNullSafety = false ;
689- bool _noSoundNullSafety = false ;
690-
691672 /// Whether to use legacy subtype semantics rather than null-safe semantics.
692673 /// This is `true` if unsound null-safety semantics are being used, since
693674 /// dart2js does not emit warnings for unsound null-safety.
694- bool get useLegacySubtyping {
695- return nullSafetyMode == NullSafetyMode .unsound;
696- }
675+ bool get useLegacySubtyping => false ;
697676
698677 /// If specified, a bundle of optimizations to enable (or disable).
699678 int ? optimizationLevel;
@@ -937,9 +916,6 @@ class CompilerOptions implements DiagnosticOptions {
937916 ..enableUserAssertions =
938917 _hasOption (options, Flags .enableCheckedMode) ||
939918 _hasOption (options, Flags .enableAsserts)
940- ..enableNullAssertions =
941- _hasOption (options, Flags .enableCheckedMode) ||
942- _hasOption (options, Flags .enableNullAssertions)
943919 ..nativeNullAssertions = _hasOption (options, Flags .nativeNullAssertions)
944920 .._noNativeNullAssertions = _hasOption (
945921 options,
@@ -1014,8 +990,6 @@ class CompilerOptions implements DiagnosticOptions {
1014990 .._cfeOnly = _hasOption (options, Flags .cfeOnly)
1015991 .._stageFlag = _extractStringOption (options, '${Flags .stage }=' , null )
1016992 ..debugGlobalInference = _hasOption (options, Flags .debugGlobalInference)
1017- .._soundNullSafety = _hasOption (options, Flags .soundNullSafety)
1018- .._noSoundNullSafety = _hasOption (options, Flags .noSoundNullSafety)
1019993 .._mergeFragmentsThreshold = _extractIntOption (
1020994 options,
1021995 '${Flags .mergeFragmentsThreshold }=' ,
@@ -1094,12 +1068,6 @@ class CompilerOptions implements DiagnosticOptions {
10941068 equalMaps (experimentalFlags, fe.defaultExperimentalFlags)) {
10951069 throw ArgumentError ("Missing required ${Flags .platformBinaries }" );
10961070 }
1097- if (_soundNullSafety && _noSoundNullSafety) {
1098- throw ArgumentError (
1099- "'${Flags .soundNullSafety }' is incompatible with "
1100- "'${Flags .noSoundNullSafety }'" ,
1101- );
1102- }
11031071 if (nativeNullAssertions && _noNativeNullAssertions) {
11041072 throw ArgumentError (
11051073 "'${Flags .nativeNullAssertions }' is incompatible with "
@@ -1112,7 +1080,7 @@ class CompilerOptions implements DiagnosticOptions {
11121080 "'${Flags .noInteropNullAssertions }'" ,
11131081 );
11141082 }
1115- if (nullSafetyMode == NullSafetyMode .sound && experimentNullSafetyChecks) {
1083+ if (experimentNullSafetyChecks) {
11161084 throw ArgumentError (
11171085 '${Flags .experimentNullSafetyChecks } is incompatible '
11181086 'with sound null safety.' ,
@@ -1135,9 +1103,6 @@ class CompilerOptions implements DiagnosticOptions {
11351103 features.forceCanary ();
11361104 }
11371105
1138- if (_soundNullSafety) nullSafetyMode = NullSafetyMode .sound;
1139- if (_noSoundNullSafety) nullSafetyMode = NullSafetyMode .unsound;
1140-
11411106 if (optimizationLevel != null ) {
11421107 if (optimizationLevel == 0 ) {
11431108 disableInlining = true ;
@@ -1187,12 +1152,7 @@ class CompilerOptions implements DiagnosticOptions {
11871152 omitLateNames = false ;
11881153 }
11891154
1190- if (nullSafetyMode != NullSafetyMode .sound) {
1191- // Technically, we should still assert if the user passed in a flag to
1192- // assert, but this was not the behavior before, so to avoid a breaking
1193- // change, we don't assert in unsound mode.
1194- nativeNullAssertions = false ;
1195- } else if (_noNativeNullAssertions) {
1155+ if (_noNativeNullAssertions) {
11961156 // Never assert if the user tells us not to.
11971157 nativeNullAssertions = false ;
11981158 } else if (! nativeNullAssertions &&
0 commit comments