0ae4f93e29
This is a re-land of 152cc24, which has been reverted in 3f9ae7. Unlike
the original change, this doesn't alter the `dart:_wasm` library.
We can revisit an API split to remove `js_interop` APIs there once the
standalone target has progressed further.
Original change's description:
> [dart2wasm] Split patch files by whether they use JS interop
>
> The eventual goal of the `dart2wasm_standalone` platform is to not rely
> on a JavaScript environment, which requires rewriting everything that
> currently relies on `js_interop` or `JS()` helpers.
>
> Since most of the patches are still written in Dart and we don't want
> to duplicate that code for the standalone target, this splits patch
> files by whether they rely on JS-interop or not. The main entrypoint
> for each patch (e.g. `lib/_internal/wasm/lib/core_patch.dart`) no
> longer relies on JS-interop and can safely be used in the standalone
> target. Part files that previously needed to use JS-interop have been
> moved into separate patches now, which allows us to migrate them
> incrementally.
>
> In some cases, it was easier to add new patch files:
>
> - Similar to the split between `boxed_int` and the `toString` helper
> patch, we now have the same for `boxed_double`.
> - The functionality to copy from JS typed data wrappers into Dart typed
> lists wouldn't work with standalone, so I've moved it into a separate
> method we can patch to be a noop.
> - `dart:_wasm` exposes APIs to convert between `JSAny` and `externref`.
> This is part of a public API, but I had to move those declarations
> into a patch file because they wouldn't work with standalone.
> Arguably, a separate library (`dart:_wasm_js_interop`?) would be
> cleaner but it might be fine as long as `dart:_wasm` is experimental?
>
> For now, new patch files relying on JS interop are also applied to the
> standalone target. They are marked with a comment indicating that they
> need to be migrated though.
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try
Change-Id: I98a628f96cba7e0f0af7e86e058cda43c2c73898
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495302
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
34 lines
1.5 KiB
Dart
34 lines
1.5 KiB
Dart
// 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.
|
|
|
|
// dart2wasmOptions=--no-strip-wasm --extra-compiler-option=-DTEST_COMPILATION_DIR=$TEST_COMPILATION_DIR
|
|
|
|
import 'source_map_simple_lib.dart' as Lib;
|
|
|
|
void main() {
|
|
Lib.testMain('source_map_simple', frameDetails);
|
|
}
|
|
|
|
const List<(String?, int?, int?, String?)?> frameDetails = [
|
|
('errors_patch.dart', 20, 39, '_throwWithCurrentStackTrace'),
|
|
('source_map_simple_lib.dart', 18, 3, 'g'),
|
|
('source_map_simple_lib.dart', 14, 3, 'f'),
|
|
('source_map_simple_lib.dart', 43, 5, 'testMain'),
|
|
('source_map_simple_test.dart', 10, 7, 'main'),
|
|
('invoke_main_patch.dart', 12, 13, '_invokeMainArg0'),
|
|
null,
|
|
('invoke_main_patch.dart', 46, 5, '_invokeMain'),
|
|
];
|
|
|
|
/*
|
|
at module0.Error._throwWithCurrentStackTrace <noInline> (wasm://wasm/module0-0010c51a:wasm-function[106]:0xf8c1)
|
|
at module0.g (wasm://wasm/module0-0010c51a:wasm-function[254]:0x11767)
|
|
at module0.f (wasm://wasm/module0-0010c51a:wasm-function[251]:0x1173d)
|
|
at module0.testMain (wasm://wasm/module0-0010c51a:wasm-function[249]:0x112aa)
|
|
at module0.main (wasm://wasm/module0-0010c51a:wasm-function[248]:0x11226)
|
|
at module0._invokeMainArg0 (wasm://wasm/module0-0010c51a:wasm-function[247]:0x1121c)
|
|
at module0._invokeMainInternal (wasm://wasm/module0-0010c51a:wasm-function[81]:0xf50f)
|
|
at module0._invokeMain (wasm://wasm/module0-0010c51a:wasm-function[76]:0xf476)
|
|
*/
|