Skip to content

Commit

Permalink
Version 3.4.0-201.0.dev
Browse files Browse the repository at this point in the history
Merge c0e089a into dev
  • Loading branch information
Dart CI committed Mar 5, 2024
2 parents 9ea8813 + c0e089a commit d74a953
Show file tree
Hide file tree
Showing 14 changed files with 788 additions and 592 deletions.
14 changes: 11 additions & 3 deletions pkg/_fe_analyzer_shared/lib/src/util/runtimes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

import 'dart:isolate';
import 'dart:typed_data';

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

bool _checkForKernelRuntime() {
// `createUriForKernelBlob` throws `UnsupportedError` if kernel blobs are not
// supported at all. We don't actually want to register kernel so pass
// invalid kernel, an empty list, resulting in an `ArgumentError` if kernel
// blobs are supported.
try {
(Isolate.current as dynamic).createUriForKernelBlob;
return true;
} catch (_) {
(Isolate.current as dynamic)
.createUriForKernelBlob(new Uint8List.fromList(const []));
throw new StateError('Expected failure.');
} on UnsupportedError {
return false;
} on ArgumentError {
return true;
}
}
Loading

0 comments on commit d74a953

Please sign in to comment.