Skip to content

Commit 1d3d9cd

Browse files
committed
Deprecated CompilerOptions' soundNullSafety and related usage
1 parent 4236027 commit 1d3d9cd

13 files changed

+39
-91
lines changed

dwds/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- Replace deprecated JS code `this.__proto__` with `Object.getPrototypeOf(this)`. - [#2500](https://github.com/dart-lang/webdev/pull/2500)
44
- Migrate injected client code to `package:web`. - [#2491](https://github.com/dart-lang/webdev/pull/2491)
5-
- Deprecated MetadataProvider's soundNullSafety'. - [#2427](https://github.com/dart-lang/webdev/issues/2427)
5+
- Deprecated MetadataProvider's & CompilerOptions' soundNullSafety. - [#2427](https://github.com/dart-lang/webdev/issues/2427)
66

77
## 24.1.0
88

dwds/lib/src/debugging/metadata/provider.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ class MetadataProvider {
6969
/// A sound null safety mode for the whole app.
7070
///
7171
/// All libraries have to agree on null safety mode.
72-
@Deprecated(
73-
'This field is deprecated. Use sound null safety enforcement instead.',
74-
)
72+
@Deprecated('Only sound null safety is supported as of Dart 3.0')
7573
Future<bool> get soundNullSafety async {
7674
await _initialize();
7775
return true;

dwds/lib/src/services/chrome_proxy_service.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,11 @@ class ChromeProxyService implements VmServiceInterface {
204204
final moduleFormat = loadStrategy.moduleFormat;
205205
final canaryFeatures = loadStrategy.buildSettings.canaryFeatures;
206206
final experiments = loadStrategy.buildSettings.experiments;
207-
final soundNullSafety = true;
208207

209208
_logger.info('Initializing expression compiler for $entrypoint');
210209

211210
final compilerOptions = CompilerOptions(
212211
moduleFormat: ModuleFormat.values.byName(moduleFormat),
213-
soundNullSafety: soundNullSafety,
214212
canaryFeatures: canaryFeatures,
215213
experiments: experiments,
216214
);

dwds/lib/src/services/expression_compiler.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
/// Options passed to DDC and the expression compiler.
66
class CompilerOptions {
77
final ModuleFormat moduleFormat;
8+
9+
@Deprecated('Only sound null safety is supported as of Dart 3.0')
810
final bool soundNullSafety;
11+
912
final bool canaryFeatures;
1013
final List<String> experiments;
1114

1215
CompilerOptions({
1316
required this.moduleFormat,
14-
required this.soundNullSafety,
17+
this.soundNullSafety = true,
1518
required this.canaryFeatures,
1619
required this.experiments,
1720
});

dwds/lib/src/services/expression_compiler_service.dart

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ class _Compiler {
5353
/// expression compilation (summaries, libraries spec, compiler worker
5454
/// snapshot).
5555
///
56-
/// [soundNullSafety] indicates if the compiler should support sound
57-
/// null safety.
58-
///
5956
/// Performs handshake with the isolate running expression compiler
6057
/// worker to establish communication via send/receive ports, returns
6158
/// the service after the communication is established.
@@ -69,16 +66,10 @@ class _Compiler {
6966
bool verbose,
7067
) async {
7168
sdkConfiguration.validateSdkDir();
72-
if (compilerOptions.soundNullSafety) {
73-
sdkConfiguration.validateSoundSummaries();
74-
} else {
75-
sdkConfiguration.validateWeakSummaries();
76-
}
69+
sdkConfiguration.validateSoundSummaries();
7770

7871
final workerUri = sdkConfiguration.compilerWorkerUri!;
79-
final sdkSummaryUri = compilerOptions.soundNullSafety
80-
? sdkConfiguration.soundSdkSummaryUri!
81-
: sdkConfiguration.weakSdkSummaryUri!;
72+
final sdkSummaryUri = sdkConfiguration.soundSdkSummaryUri!;
8273

8374
final args = [
8475
'--experimental-expression-compiler',
@@ -91,9 +82,7 @@ class _Compiler {
9182
'--module-format',
9283
compilerOptions.moduleFormat.name,
9384
if (verbose) '--verbose',
94-
compilerOptions.soundNullSafety
95-
? '--sound-null-safety'
96-
: '--no-sound-null-safety',
85+
'--sound-null-safety',
9786
for (final experiment in compilerOptions.experiments)
9887
'--enable-experiment=$experiment',
9988
if (compilerOptions.canaryFeatures) '--canary',

dwds/test/expression_compiler_service_ddc_and_canary_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ void main() async {
1616
testAll(
1717
compilerOptions: CompilerOptions(
1818
moduleFormat: ModuleFormat.ddc,
19-
soundNullSafety: true,
2019
canaryFeatures: true,
2120
experiments: const <String>[],
2221
),

dwds/test/expression_compiler_service_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ void main() async {
1616
testAll(
1717
compilerOptions: CompilerOptions(
1818
moduleFormat: ModuleFormat.amd,
19-
soundNullSafety: true,
2019
canaryFeatures: false,
2120
experiments: const <String>[],
2221
),

dwds/test/fixtures/utilities.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,5 +300,5 @@ class TestCompilerOptions extends CompilerOptions {
300300
required super.canaryFeatures,
301301
super.experiments = const [],
302302
super.moduleFormat = ModuleFormat.amd,
303-
}) : super(soundNullSafety: true);
303+
});
304304
}

dwds/test/metadata_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const _emptySourceMetadata =
1616
'{"version":"1.0.0","name":"web/main","closureName":"load__web__main",'
1717
'"sourceMapUri":"foo/web/main.ddc.js.map",'
1818
'"moduleUri":"foo/web/main.ddc.js",'
19-
'"soundNullSafety":true,'
2019
'"libraries":[{"name":"main",'
2120
'"importUri":"org-dartlang-app:///web/main.dart",'
2221
'"fileUri":"org-dartlang-app:///web/main.dart","partUris":[]}]}\n'
@@ -26,7 +25,6 @@ const _fileUriMetadata =
2625
'{"version":"1.0.0","name":"web/main","closureName":"load__web__main",'
2726
'"sourceMapUri":"foo/web/main.ddc.js.map",'
2827
'"moduleUri":"foo/web/main.ddc.js",'
29-
'"soundNullSafety":true,'
3028
'"libraries":[{"name":"main",'
3129
'"importUri":"file:/Users/foo/blah/sample/lib/bar.dart",'
3230
'"fileUri":"org-dartlang-app:///web/main.dart","partUris":[]}]}\n'

frontend_server_common/lib/src/devfs.dart

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class WebDevFS {
2424
required this.projectDirectory,
2525
required this.packageUriMapper,
2626
required this.index,
27-
required this.soundNullSafety,
27+
this.soundNullSafety = true,
2828
this.urlTunneler,
2929
required this.sdkLayout,
3030
required this.ddcModuleFormat,
@@ -38,7 +38,10 @@ class WebDevFS {
3838
final PackageUriMapper packageUriMapper;
3939
final String index;
4040
final UrlEncoder? urlTunneler;
41+
42+
@Deprecated('Only sound null safety is supported as of Dart 3.0')
4143
final bool soundNullSafety;
44+
4245
final TestSdkLayout sdkLayout;
4346
final ModuleFormat ddcModuleFormat;
4447
late final Directory _savedCurrentDirectory;
@@ -142,9 +145,8 @@ class WebDevFS {
142145

143146
assetServer.writeFile('main_module.digests', '{}');
144147

145-
final sdk = soundNullSafety ? dartSdk : dartSdkWeak;
146-
final sdkSourceMap =
147-
soundNullSafety ? dartSdkSourcemap : dartSdkSourcemapWeak;
148+
final sdk = dartSdk;
149+
final sdkSourceMap = dartSdkSourcemap;
148150
assetServer.writeFile('dart_sdk.js', sdk.readAsStringSync());
149151
assetServer.writeFile('dart_sdk.js.map', sdkSourceMap.readAsStringSync());
150152

@@ -189,21 +191,11 @@ class WebDevFS {
189191
File get ddcModuleLoaderJS =>
190192
fileSystem.file(sdkLayout.ddcModuleLoaderJsPath);
191193
File get requireJS => fileSystem.file(sdkLayout.requireJsPath);
192-
File get dartSdkWeak => fileSystem.file(switch (ddcModuleFormat) {
193-
ModuleFormat.amd => sdkLayout.weakAmdJsPath,
194-
ModuleFormat.ddc => sdkLayout.weakDdcJsPath,
195-
_ => throw Exception('Unsupported DDC module format $ddcModuleFormat.')
196-
});
197194
File get dartSdk => fileSystem.file(switch (ddcModuleFormat) {
198195
ModuleFormat.amd => sdkLayout.soundAmdJsPath,
199196
ModuleFormat.ddc => sdkLayout.soundDdcJsPath,
200197
_ => throw Exception('Unsupported DDC module format $ddcModuleFormat.')
201198
});
202-
File get dartSdkSourcemapWeak => fileSystem.file(switch (ddcModuleFormat) {
203-
ModuleFormat.amd => sdkLayout.weakAmdJsMapPath,
204-
ModuleFormat.ddc => sdkLayout.weakDdcJsMapPath,
205-
_ => throw Exception('Unsupported DDC module format $ddcModuleFormat.')
206-
});
207199
File get dartSdkSourcemap => fileSystem.file(switch (ddcModuleFormat) {
208200
ModuleFormat.amd => sdkLayout.soundAmdJsMapPath,
209201
ModuleFormat.ddc => sdkLayout.soundDdcJsMapPath,

0 commit comments

Comments
 (0)