Skip to content

Commit d74a953

Browse files
author
Dart CI
committed
Version 3.4.0-201.0.dev
Merge c0e089a into dev
2 parents 9ea8813 + c0e089a commit d74a953

File tree

14 files changed

+788
-592
lines changed

14 files changed

+788
-592
lines changed

pkg/_fe_analyzer_shared/lib/src/util/runtimes.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'dart:isolate';
6+
import 'dart:typed_data';
67

78
/// Whether the current runtime can register kernel blobs and launch kernel
89
/// isolates.
@@ -11,10 +12,17 @@ bool get isKernelRuntime => _isKernelRuntime ??= _checkForKernelRuntime();
1112
bool? _isKernelRuntime;
1213

1314
bool _checkForKernelRuntime() {
15+
// `createUriForKernelBlob` throws `UnsupportedError` if kernel blobs are not
16+
// supported at all. We don't actually want to register kernel so pass
17+
// invalid kernel, an empty list, resulting in an `ArgumentError` if kernel
18+
// blobs are supported.
1419
try {
15-
(Isolate.current as dynamic).createUriForKernelBlob;
16-
return true;
17-
} catch (_) {
20+
(Isolate.current as dynamic)
21+
.createUriForKernelBlob(new Uint8List.fromList(const []));
22+
throw new StateError('Expected failure.');
23+
} on UnsupportedError {
1824
return false;
25+
} on ArgumentError {
26+
return true;
1927
}
2028
}

0 commit comments

Comments
 (0)