Skip to content

Commit

Permalink
[Library] Change signature of dart:io exit to return Never
Browse files Browse the repository at this point in the history
(see issue - #42006)

Bug:42006
Change-Id: I72b474c6ea398f4e7bd746beac650e625be8857c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148920
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
  • Loading branch information
a-siva authored and commit-bot@chromium.org committed May 29, 2020
1 parent 02bfe67 commit 1c6fa36
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,13 @@

### Core libraries

#### `dart:io`

* [#42006][]: The signature of `exit` has been changed to return the
`Never`type instead of `void`. since no code will run after it,

[#42006]: https://github.com/dart-lang/sdk/issues/42006

#### `dart:convert`

* **Breaking Change** [#41100][]: When encoding a string containing unpaired
Expand Down
2 changes: 1 addition & 1 deletion sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart
Expand Up @@ -303,7 +303,7 @@ class _Platform {
@patch
class _ProcessUtils {
@patch
static void _exit(int status) {
static Never _exit(int status) {
throw UnsupportedError("ProcessUtils._exit");
}

Expand Down
2 changes: 1 addition & 1 deletion sdk_nnbd/lib/_internal/js_runtime/lib/io_patch.dart
Expand Up @@ -303,7 +303,7 @@ class _Platform {
@patch
class _ProcessUtils {
@patch
static void _exit(int status) {
static Never _exit(int status) {
throw new UnsupportedError("ProcessUtils._exit");
}

Expand Down
2 changes: 1 addition & 1 deletion sdk_nnbd/lib/_internal/vm/bin/process_patch.dart
Expand Up @@ -135,7 +135,7 @@ Function _getWatchSignalInternal() => _ProcessUtils._watchSignalInternal;
@patch
class _ProcessUtils {
@patch
static void _exit(int status) native "Process_Exit";
static Never _exit(int status) native "Process_Exit";
@patch
static void _setExitCode(int status) native "Process_SetExitCode";
@patch
Expand Down
4 changes: 2 additions & 2 deletions sdk_nnbd/lib/io/process.dart
Expand Up @@ -7,7 +7,7 @@ part of dart.io;
// TODO(ager): The only reason for this class is that we
// cannot patch a top-level at this point.
class _ProcessUtils {
external static void _exit(int status);
external static Never _exit(int status);
external static void _setExitCode(int status);
external static int _getExitCode();
external static void _sleep(int millis);
Expand Down Expand Up @@ -49,7 +49,7 @@ class _ProcessUtils {
* program to the surrounding environment. This will avoid any
* cross-platform issues.
*/
void exit(int code) {
Never exit(int code) {
ArgumentError.checkNotNull(code, "code");
if (!_EmbedderConfig._mayExit) {
throw new UnsupportedError(
Expand Down

0 comments on commit 1c6fa36

Please sign in to comment.