[ddc] Move async_status_codes to shared sdk library.
This will allow DDC and dart2js to share these values for their async systems.
Change-Id: If6eef5de535cdf55e10adca3b2de11c408df4070
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374520
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
diff --git a/pkg/compiler/lib/src/js/rewrite_async.dart b/pkg/compiler/lib/src/js/rewrite_async.dart
index 055480b..f30fbcb 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -7,7 +7,7 @@
import 'dart:collection';
import 'dart:math' show max;
-import 'package:js_runtime/synced/async_status_codes.dart' as status_codes;
+import 'package:js_shared/synced/async_status_codes.dart' as status_codes;
import '../common.dart';
import '../util/util.dart' show Pair;
diff --git a/pkg/js_runtime/lib/synced/async_status_codes.dart b/pkg/js_shared/lib/synced/async_status_codes.dart
similarity index 94%
rename from pkg/js_runtime/lib/synced/async_status_codes.dart
rename to pkg/js_shared/lib/synced/async_status_codes.dart
index a3d9cee..96f0b13 100644
--- a/pkg/js_runtime/lib/synced/async_status_codes.dart
+++ b/pkg/js_shared/lib/synced/async_status_codes.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/sdk/lib/_internal/js_runtime/lib/synced/async_status_codes.dart b/sdk/lib/_internal/js_runtime/lib/synced/async_status_codes.dart
deleted file mode 100644
index a3d9cee..0000000
--- a/sdk/lib/_internal/js_runtime/lib/synced/async_status_codes.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// ignore_for_file: constant_identifier_names
-
-/// Codes that transformed sync*/async/async* functions use to communicate with
-/// js_helper functions.
-library;
-
-const int SUCCESS = 0;
-const int ERROR = 1;
-const int STREAM_WAS_CANCELED = 2;
-
-// A sync* function transformed 'body' returns the following codes to
-// communicate the updated state of the `_SyncStarIterator` (Iterator).
-
-/// The sync* body has terminated. The body should not be called again.
-const int SYNC_STAR_DONE = 0;
-
-/// The sync* body has updated the `_current` field of the Iterator with the
-/// value that is yielded.
-const int SYNC_STAR_YIELD = 1;
-
-/// The sync* body has updated the Iterator with an Iterable. The elements of
-/// the Iterable are the next values of the Iterator.
-const int SYNC_STAR_YIELD_STAR = 2;
-
-/// The sync* body throws an exception. The exception has been stored on a field
-/// of the Iterator.
-const int SYNC_STAR_UNCAUGHT_EXCEPTION = 3;
diff --git a/pkg/js_runtime/lib/synced/async_status_codes.dart b/sdk/lib/_internal/js_shared/lib/synced/async_status_codes.dart
similarity index 94%
copy from pkg/js_runtime/lib/synced/async_status_codes.dart
copy to sdk/lib/_internal/js_shared/lib/synced/async_status_codes.dart
index a3d9cee..96f0b13 100644
--- a/pkg/js_runtime/lib/synced/async_status_codes.dart
+++ b/sdk/lib/_internal/js_shared/lib/synced/async_status_codes.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
diff --git a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
index 2daace9..1b447f3 100644
--- a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
+++ b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
@@ -285,7 +285,7 @@
platforms: DART2JS_PLATFORM,
),
'_async_status_codes': const LibraryInfo(
- '_internal/js_runtime/lib/synced/async_status_codes.dart',
+ '_internal/js_shared/lib/synced/async_status_codes.dart',
categories: '',
documented: false,
platforms: DART2JS_PLATFORM,
diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json
index ff72be0..f53b41d 100644
--- a/sdk/lib/libraries.json
+++ b/sdk/lib/libraries.json
@@ -516,7 +516,7 @@
"uri": "_internal/js_shared/lib/synced/embedded_names.dart"
},
"_async_status_codes": {
- "uri": "_internal/js_runtime/lib/synced/async_status_codes.dart"
+ "uri": "_internal/js_shared/lib/synced/async_status_codes.dart"
},
"_invocation_mirror_constants": {
"uri": "_internal/js_runtime/lib/synced/invocation_mirror_constants.dart"
@@ -534,6 +534,9 @@
"_runtime": {
"uri": "_internal/js_dev_runtime/private/ddc_runtime/runtime.dart"
},
+ "_async_status_codes": {
+ "uri": "_internal/js_shared/lib/synced/async_status_codes.dart"
+ },
"_debugger": {
"uri": "_internal/js_dev_runtime/private/debugger.dart"
},
diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml
index 773582e..c267ff6 100644
--- a/sdk/lib/libraries.yaml
+++ b/sdk/lib/libraries.yaml
@@ -436,7 +436,7 @@
uri: "_internal/js_shared/lib/synced/embedded_names.dart"
_async_status_codes:
- uri: "_internal/js_runtime/lib/synced/async_status_codes.dart"
+ uri: "_internal/js_shared/lib/synced/async_status_codes.dart"
_invocation_mirror_constants:
uri: "_internal/js_runtime/lib/synced/invocation_mirror_constants.dart"
@@ -452,6 +452,9 @@
_runtime:
uri: "_internal/js_dev_runtime/private/ddc_runtime/runtime.dart"
+ _async_status_codes:
+ uri: "_internal/js_shared/lib/synced/async_status_codes.dart"
+
_debugger:
uri: "_internal/js_dev_runtime/private/debugger.dart"