Skip to content

Commit 05b806a

Browse files
committed
[dartdevc,nnbd] analyze whole sdk, fix isolate errors
This should fix all ddc isolate errors. Remaining two io/_http errors are due to: #40482 The rest are mirrors. Do we think we'll be able to remove it altogether? If not, I can take a pass to fix. Change-Id: I4cef9773b5fa36490bdfbc08a06fae6cd80c5eae Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134860 Reviewed-by: Nicholas Shahan <[email protected]> Reviewed-by: Sigmund Cherem <[email protected]>
1 parent 7869bc3 commit 05b806a

File tree

3 files changed

+56
-6
lines changed

3 files changed

+56
-6
lines changed

pkg/dev_compiler/tool/check_nnbd_sdk.dart

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,60 @@ void main(List<String> argv) {
4646
'--nnbd',
4747
]);
4848

49-
var emptyProgramUri = baseUri.resolve('empty_program.dart');
50-
File.fromUri(emptyProgramUri).writeAsStringSync('''
49+
var isWeb = false;
50+
var isNative = false;
51+
switch (target) {
52+
case 'dartdevc':
53+
case 'dart2js':
54+
isWeb = true;
55+
break;
56+
case 'flutter':
57+
case 'vm':
58+
isNative = true;
59+
break;
60+
}
61+
62+
var core = '''
63+
import 'dart:async';
64+
import 'dart:collection';
65+
import 'dart:convert';
66+
import 'dart:core';
67+
import 'dart:developer';
68+
import 'dart:math';
69+
import 'dart:typed_data';
70+
''';
71+
72+
var web = !isWeb
73+
? ''
74+
: '''
5175
import 'dart:js';
5276
import 'dart:js_util';
77+
import 'dart:indexed_db';
5378
import 'dart:html';
79+
import 'dart:html_common';
80+
import 'dart:svg';
81+
import 'dart:web_audio';
82+
import 'dart:web_gl';
83+
import 'dart:web_sql';
84+
''';
85+
86+
var native = !isNative
87+
? '''
88+
import 'dart:io';
89+
import 'dart:isolate';
90+
'''
91+
: '''
92+
import 'dart:ffi';
93+
import 'dart:io';
94+
import 'dart:isolate';
95+
import 'dart:mirrors';
96+
''';
97+
98+
var emptyProgramUri = baseUri.resolve('empty_program.dart');
99+
File.fromUri(emptyProgramUri).writeAsStringSync('''
100+
$core
101+
$web
102+
$native
54103
55104
main() {}
56105
''');
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
1+
ERROR|STATIC_WARNING|UNCHECKED_USE_OF_NULLABLE_VALUE|lib/_http/http.dart|7638|7|11|The expression is nullable and must be null-checked before it can be used.
2+
ERROR|STATIC_WARNING|UNCHECKED_USE_OF_NULLABLE_VALUE|lib/_http/http.dart|8726|5|24|The expression is nullable and must be null-checked before it can be used.

sdk_nnbd/lib/_internal/js_dev_runtime/patch/isolate_patch.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Isolate {
4343
bool errorsAreFatal = true,
4444
bool? checked,
4545
Map<String, String>? environment,
46-
Uri packageRoot,
46+
Uri? packageRoot,
4747
Uri? packageConfig,
4848
bool automaticPackageResolution = false,
4949
String? debugName}) =>
@@ -69,7 +69,7 @@ class Isolate {
6969
void kill({int priority = beforeNextEvent}) => _unsupported();
7070
@patch
7171
void ping(SendPort responsePort,
72-
{Object response, int priority = immediate}) =>
72+
{Object? response, int priority = immediate}) =>
7373
_unsupported();
7474

7575
@patch
@@ -101,7 +101,7 @@ class _ReceivePort extends Stream implements ReceivePort {
101101
StreamSubscription listen(void Function(dynamic)? onData,
102102
{Function? onError,
103103
void Function()? onDone,
104-
bool cancelOnError = true}) =>
104+
bool? cancelOnError = true}) =>
105105
_unsupported();
106106
}
107107

0 commit comments

Comments
 (0)