[dart2wasm, standalone] Migrate String

This migrates the `String` implementation from using JS interop to
explicit host imports for the standalone target.

This moves a few helper methods shared between the JS and standalone
targets to `dart:_string_helper`. This also moves the embedder regexp
implementation to `dart:_string` to be able to access internals in some
string methods (similar to how the JS implementation special-cases
`JSSyntaxRegExp`).

This removes the final real use of JS-interop in the standalone target.
So, we can:

 - Remove internal JS helper libraries from the target.
 - Skip JS-interop transformations in the compiler.
 - Stop emitting a helper module and support script.

Because `js_interop` is imported in `dart:_wasm`, we can't remove the
library entirely. This replaces it with a stub to avoid compilation
errors, a proper removal is tracked in dartbug.com/63166.

Change-Id: Ide495c210c3a272438deebf8fe4f3f44ba314ffa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501960
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Simon Binder
2026-05-20 00:22:27 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 3de2ddee09
commit 58f9d88fb2
58 changed files with 1606 additions and 677 deletions
+5
View File
@@ -49,3 +49,8 @@ LibTest/js_interop/importModule_A02_t01: Skip # https://github.com/dart-lang/sdk
LibTest/js_interop/importModule_A02_t02: Skip # https://github.com/dart-lang/sdk/issues/61204
LibTest/js_interop/importModule_A02_t03: Skip # https://github.com/dart-lang/sdk/issues/61204
LibTest/js_interop/interop_A08_t05: Skip # https://github.com/dart-lang/sdk/issues/61204
[ $compiler == dart2wasm && $dart2wasm_standalone ]
LanguageFeatures/Augmentations/js_interop/*: SkipByDesign # This is a generic WebAssembly target without JavaScript support
LibTest/js_interop/*: SkipByDesign # This is a generic WebAssembly target without JavaScript support
LibTest/js_interop_unsafe/*: SkipByDesign # This is a generic WebAssembly target without JavaScript support
+6 -2
View File
@@ -37,9 +37,13 @@ main() {
const bool.fromEnvironment("dart.library.web_gl"),
);
// All web backends support `dart:js_interop`
// All web backends support `dart:js_interop`. dart2wasm standalone is tested
// on the web but is not a web backend.
final isDart2WasmStandalone = const String.fromEnvironment(
"test_runner.configuration",
).contains('standalone');
Expect.equals(
isWebConfiguration,
isWebConfiguration && !isDart2WasmStandalone,
const bool.fromEnvironment("dart.library.js_interop"),
);
+4
View File
@@ -135,6 +135,10 @@ js_interop_unsafe/*: SkipByDesign # Only supported on web backends.
[ $compiler != dart2js && $compiler != ddc ]
web/*: SkipByDesign
[ $compiler == dart2wasm && $dart2wasm_standalone ]
js/*: SkipByDesign # This is a generic WebAssembly target without JavaScript support
js_interop_unsafe/*: SkipByDesign # This is a generic WebAssembly target without JavaScript support
[ $runtime == chrome && $system == macos ]
convert/streamed_conversion_utf8_encode_test: SkipSlow # Times out. Issue 22050
html/canvasrendering/arc_test: Skip # Issue 42048