Commit graph

1173 commits

Author SHA1 Message Date
Martin Kustermann c625797f8a [dart2wasm] Implement dart:developer in dart2wasm
* We migrate the `dart:developer` implementation of dart2js to
static interop.

* We make dart2wasm use the same implementation as dart2js.

Closes https://github.com/dart-lang/sdk/issues/54991

Change-Id: I7873edc7e804500c8eca878367d9045c98a1c2e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354101
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-02-26 11:23:29 +00:00
Srujan Gaddam 3b294fdab2 [dart:js_interop] Add isA helper
Closes https://github.com/dart-lang/sdk/issues/54138

Adds a helper to do better type-checks so that users don't
accidentally using is checks or have to manually do the right
typeof or instanceof checks. In order to do this, there is
some refactoring to make ExportCreator a SharedInteropTransformer
(as it's shared across all backends) so that we can reuse an
existing visitor. In the same class, we remove unnecessary setting
of parent pointers. We should clean up the fileOffsets as well,
but dart2js verifies that those are set, so we keep them as is
for now. Also adds some static errors for edge cases.

CoreLibraryReviewExempt: Helper for web-specific library.
Change-Id: I34d818ada1349b69afd15d170d3fafa0460f65fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347225
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-01-25 18:52:45 +00:00
Srujan Gaddam f04e42be46 [dart:js_interop] Allow dart:html types in external signatures
Closes https://github.com/dart-lang/sdk/issues/54482

This is generally useful for users working around some limitations of
dart:html. While we want to encourage users to use package:web,
dart:html is not available on dart2wasm and users can use dart:html in
other ways already e.g. in an interop extension type, so it doesn't make
sense to disallow this. We also allow type parameters that extend these
types as well.

In order to make this a bit more performant (subtyping checks may be
expensive), code is refactored to cache more readily and separate the
notion of an allowed representation type vs interop extension type. We
also define the notion of a "core" interop type, which will be useful
when we want to efficiently query what interop type users are using
underneath the possible layers of extension types.

A few missing tests around typed_data are added and the error around
invalid types is reworded to include this change and be more consise.

Change-Id: I256b0cce4355d2a21853b0c5bf641166cafc523e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347224
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-01-25 02:10:44 +00:00
Srujan Gaddam 4110b48950 Use asyncTest instead of main async in JS interop tests
The former waits for the test to complete while the latter does
not. Testing this on d8 uncovered two issues which are also
addressed in this CL:

1. async_test has a Promise that is rejected before it is handled.
2. Tests that use Promises don't work correctly on dart2js + d8,
and are therefore skipped for now until the issue is resolved.

Change-Id: I1fac1f4c653bb9ee30ed683d1b0d11bfbf14a58c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343682
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-01-05 00:21:29 +00:00
Srujan Gaddam 4804d54792 [dart:js_interop] Add support for dynamically importing modules
Closes https://github.com/dart-lang/sdk/issues/52852

Allows importing of modules using the JS "import()" expression.
The result is a promise that resolves to a module, from which users
can then access exported members from.

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: I4c1caae689be55d1dbb038448e3243bcb80ac8b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343683
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-01-03 01:00:19 +00:00
Srujan Gaddam 3a80ec26be Reland "[dart2wasm] Disallow use of old interop libraries"
Includes small wording modifications and extra allowlisting for
benchmarks and Flutter engine tests.

This reverts commit c97a17b2349bcbdadd34204a65a9e7c7c13def83.

Change-Id: I2db391782c98c351d744ea7201c9421f13b97979
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343689
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2024-01-02 21:14:50 +00:00
Srujan Gaddam 5f34ac9fa0 Revert "[dart2wasm] Disallow use of old interop libraries"
This reverts commit 8c246caa91.

Reason for revert: Need to allowlist benchmarks to use package:js.

Original change's description:
> [dart2wasm] Disallow use of old interop libraries
>
> Closes https://github.com/dart-lang/sdk/issues/54004
>
> Adds an error for imports of old interop libraries. Has an
> allowlist for existing usages/migrated usages that we'll need
> to migrate.
>
> Change-Id: Ie7174ae2a50c2d03a7aa2975e8a1914a4cba8a2c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342521
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: Id7d3a3063d417830774d7a72eed5185599f9267f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343685
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2023-12-28 16:22:21 +00:00
Srujan Gaddam 8c246caa91 [dart2wasm] Disallow use of old interop libraries
Closes https://github.com/dart-lang/sdk/issues/54004

Adds an error for imports of old interop libraries. Has an
allowlist for existing usages/migrated usages that we'll need
to migrate.

Change-Id: Ie7174ae2a50c2d03a7aa2975e8a1914a4cba8a2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342521
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-12-27 18:31:37 +00:00
Srujan Gaddam b1a7ca77e0 [dart:js_interop] Move JS types to extension types
- Removes @staticInterop JS types declarations in favor of
typedefs (the function types' reified types and the typed data's
reified types have changed to make the type hierarchy work in the
JS backends).
- Adds extension types to dart:js_interop
- Adds a fromInteropObject helper to JSObject to avoid casting to
an extension type
- Deletes now stale tests
- Refactors some dart2wasm @staticInterop declarations since they
can no longer implement JS types
- Updates extension types tests to use the prefix extension_type
instead of inline_class
- Updates comments

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: Ibe04afac9585ddb99fcf6dbaa7f12050d8b876dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332860
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-12-06 21:59:58 +00:00
Ömer Sinan Ağacan 3939bf3dad [dart2wasm|js] Add element size tests for typed array to JS conversions
Change-Id: Ie7fe21630044ff2e76eee7a58fd22c95fcfd2f2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335041
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-11-10 21:25:25 +00:00
Vyacheslav Egorov aa893870df [dart2js] Disable Timeline is performance.measure is absent
Change d8 preamble to remove performance.measure entirely.

Fixes https://github.com/dart-lang/sdk/issues/53734

Change-Id: I4588e08e9126a0d0f8010f7a7786484da876bc85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330110
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-10-17 20:23:43 +00:00
Srujan Gaddam 39e8c57963 Reland "[dart2wasm] Fix nullable JS type and int parameters in JSFunction"
This is a reland of commit 54522db98f

Original change's description:
> [dart2wasm] Fix nullable JS type and int parameters in JSFunction
>
> When a callback is toJS'd with an int parameter, we should attempt
> a conversion to int if possible, similar to return values on
> external functions. Similarly, parameters where the expected type is
> a JS type should check to make the value isn't nullish before boxing,
> as JS null and undefined are converted to Dart null.
>
> Tests are added for conversion semantics of JSFunctions.
>
> Change-Id: I95566c2954d915b8cf31cdc55fed359c695404f2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323445
> Reviewed-by: Aske Simon Christensen <askesc@google.com>

Change-Id: I36ec7702b1e08fc9e4d6290952ae548b0e074ee3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325971
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-09-18 21:21:55 +00:00
Jackson Gardner 986770f744 Revert "[dart2wasm] Fix nullable JS type and int parameters in J..."
Revert submission 323446

Reason for revert: This breaks flutter web engine unit tests. See https://github.com/dart-lang/sdk/issues/53521

Reverted changes: /q/submissionid:323446

Change-Id: I9095f0791a556d4bc912e29fde274f3cb8824317
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325964
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-09-14 01:00:59 +00:00
Srujan Gaddam fedc687bd3 [dart:js_interop] Add toJSProxyOrRef
Adds a conversion function on List<JSAny?> so that users can
modify the original list and have those changes carry forward
to the array. Creates a proxy object for dart2wasm when the
list is not a JSArrayImpl. This proxy uses handler methods and
the fact that Array methods are generic to provide an Array
interface. Also fixes a small issue in the exporting so that
toJS'd function types have a valid return type.

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: I00f453aa82dd19f2913820579eb2675b799288d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323446
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-09-07 22:58:22 +00:00
Srujan Gaddam 54522db98f [dart2wasm] Fix nullable JS type and int parameters in JSFunction
When a callback is toJS'd with an int parameter, we should attempt
a conversion to int if possible, similar to return values on
external functions. Similarly, parameters where the expected type is
a JS type should check to make the value isn't nullish before boxing,
as JS null and undefined are converted to Dart null.

Tests are added for conversion semantics of JSFunctions.

Change-Id: I95566c2954d915b8cf31cdc55fed359c695404f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323445
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-09-07 22:58:22 +00:00
Srujan Gaddam 826e970588 Reland "[ddc] Don't emit type args on interop invocations"
This is a reland of commit ebc96ecb83

Angular codegen emits members that are external so DDC's external
checks need to be more specific to only focus on JS interop. This
also modifies some code logic around whether a member is JS interop
to be less permissive. Before, it claimed that any member is JS
interop if it's external and the enclosing library has a @JS
annotation, but this is only true if there is no surrounding class.

Original change's description:
> [ddc] Don't emit type args on interop invocations
>
> DDC passes type args as the first args for a generic function
> invocation, but interop functions should be excluded from doing
> so, as this leads to passing type args to JS functions.
>
> Change-Id: Ia011beca8c7a0ebb3a7e6c81cd960096045c3a06
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323941
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: Id48337ac4980d9de5de03d895d93cad3ab3a1808
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324542
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-09-07 00:54:57 +00:00
Ilya Yanok 7b5954ce18 Revert "[ddc] Don't emit type args on interop invocations"
This reverts commit ebc96ecb83.

Reason for revert: breaks G3, b/299279625

Original change's description:
> [ddc] Don't emit type args on interop invocations
>
> DDC passes type args as the first args for a generic function
> invocation, but interop functions should be excluded from doing
> so, as this leads to passing type args to JS functions.
>
> Change-Id: Ia011beca8c7a0ebb3a7e6c81cd960096045c3a06
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323941
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: Id1af7f71e80b22b48343c1d918b9431afaf6aaf4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324521
Commit-Queue: Ilya Yanok <yanok@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-09-06 15:25:58 +00:00
Srujan Gaddam ebc96ecb83 [ddc] Don't emit type args on interop invocations
DDC passes type args as the first args for a generic function
invocation, but interop functions should be excluded from doing
so, as this leads to passing type args to JS functions.

Change-Id: Ia011beca8c7a0ebb3a7e6c81cd960096045c3a06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323941
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-09-05 20:42:53 +00:00
Srujan Gaddam 38d30c57e6 [dart:js_interop] Add tests for generics with static interop
Tests class type parameters and local type parameters that are
bound to both JS types and static interop types.

Also moves and refactors a test on external extension members to
static_interop_test so that dart2wasm runs it now.

Change-Id: I6b407455d853d3d85b3d58abafdd23e6b2a03977
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316866
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-08-15 18:24:43 +00:00
Vyacheslav Egorov 4fddaf9486 [sdk] Provide Isolate.resolvePackageUriSync
TEST=augmented few existing tests

Bug: https://github.com/dart-lang/sdk/issues/52121
CoreLibraryReviewExempt: VM-only change, other platforms don't support this API.
Change-Id: I95decae6cf1a5c6ad694747313aa0dbe0a13025d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312981
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-07-11 12:59:33 +00:00
Elliott Brooks af8fb2cd73 Support the dart:developer timeline APIs in dart2js and DDC.
Exposes timeline events in the Chrome DevTools performance panel using the  Web APIs performance.mark() and performance.measure(): https://developer.mozilla.org/en-US/docs/Web/API/Performance

CoreLibraryReviewExempt: Only change in sdk/lib is updating a comment.
Bug: https://github.com/flutter/devtools/issues/4652
Change-Id: I4f934bcffeb2920ffaf9b7b3a67fc5fc3b814294
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310974
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
2023-06-30 22:38:11 +00:00
Srujan Gaddam 6fec16d482 [dart:js_interop] Require top-level externals to have @JS
To refuse confusion between dart:ffi and dart:js_interop,
top-level externals will need to be annotated when using
dart:js_interop.

Change-Id: I1e4887eb32f135df94426e43fc885346f1b9f1b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310485
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-06-22 18:45:21 +00:00
Srujan Gaddam 8f48ac3723 [dart:js_interop] Allow interop inline classes to elide @JS
Determines the ultimate representation type of an inline class to
determine if it can use external members. This allows users to
elide @JS if they don't need renaming. This CL adds some static
errors around inline interop members so its clearer that the
inline class should have an interop representation type.

There's a bit of cleanup in this CL too around interop members,
where extension members on @Native classes are now correctly
considered as interop members by the error checker.

Change-Id: I4d870d204933ea11b347ab5bb2e3de1b962f5ea3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308249
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-06-13 23:27:23 +00:00
Zach Anderson 1b9198c679 Revert "[dart:js_interop] Disallow ffi and JS interop in the same library"
This reverts commit 1c5d23e8a2.

Reason for revert: https://github.com/flutter/flutter/issues/127027

Original change's description:
> [dart:js_interop] Disallow ffi and JS interop in the same library
>
> dart2wasm can use both dart:ffi and JS interop libraries. To avoid
> confusion around external members, this disallows JS interop from
> being used in the same library as dart:ffi.
>
> Change-Id: I53e0426306be99c43b2bbfc14d65075128f0d5c5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301200
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: I1fd872e6d0cd679ec9c1842557745647385ec3af
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304100
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-05-17 16:15:36 +00:00
Srujan Gaddam 1c5d23e8a2 [dart:js_interop] Disallow ffi and JS interop in the same library
dart2wasm can use both dart:ffi and JS interop libraries. To avoid
confusion around external members, this disallows JS interop from
being used in the same library as dart:ffi.

Change-Id: I53e0426306be99c43b2bbfc14d65075128f0d5c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-05-16 22:50:46 +00:00
Joshua Litt 47b7c1f31d [js] Add js_interop_unsafe library.
CoreLibraryReviewExempt: Web only library.
Change-Id: I4d6007e0731ecae81fcc614168baee7d5e662fd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293743
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-04-27 18:51:49 +00:00
Aske Simon Christensen d1d232776a [dart2wasm] Rename the dart:wasm library to dart:_wasm.
This is an internal library not meant to be used in application code.

CoreLibraryReviewExempt: Changes only Wasm specific libraries.
Change-Id: I2f5b463382d35a442e782067ef7d9063183fe5e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292021
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-04-04 11:52:18 +00:00
Ryan Macnak 3d8424e9fc [test] Introduce status variable $simulator, and fix some cases missing simarm_x64.
TEST=ci
Change-Id: Ie2a8ac015b2d316527d648956c86d4c7cb319d26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292962
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-04-04 03:10:26 +00:00
Nicholas Shahan de44a23dd1 [test_runner] Cleanup unused compiler names
"dartdevc" and "dartdevk" have been replaced with "ddc".

Change-Id: I823bc029a0bbe1295fd731efcc32961e61c6c175
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282485
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-03-07 02:09:16 +00:00
Srujan Gaddam c50a40988a [dart:js_interop/pkg:js] Allow interop on typed_data, errors, and Array
Closes https://github.com/dart-lang/sdk/issues/50899

Allows users to interop with types that have been bound to @Native
types on the JS backends, error types that have been bound in DDC,
and the JS Array type.

Change-Id: Ic28a60127e558eb8bb017595ac54a43920a500c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282483
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-13 19:47:25 +00:00
Srujan Gaddam 2fc8685a4d [dart:js_interop] Add support for external inline and extension instance members
External inline instance members can be lowered the same way as
external extension instance members on interop classes. Similarly,
code is refactored so that external extension members can exist
on inline interop classes and are lowered accordingly.

Change-Id: I341bfeef3f1b74b54a63c963553af9230c4a10c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280621
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-02-11 00:03:57 +00:00
Nicholas Shahan 87d1806055 [test_runner] Add new name for ddc compiler
* The new compiler name "ddc" will be used for all configurations
  in an upcoming change.
* Aliases "dartdevc" and "dartdevk" will be removed in the future.

Change-Id: I2fa48e0ec043b1ba7fb70f883b39e40f338b6928
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280862
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-02-09 18:32:58 +00:00
Srujan Gaddam ff01414b8f [dart:_js_interop] Add support for statically resolvable inline class interop members
Amends lowerings on dart2wasm and JS backends to work for external
constructors/factories and static members. Tests members with and
without renaming of members/classes/libraries. Note that this does
not add support for object literal factories yet.

Change-Id: I149bef7249c1a13a31eed9f3510256d407b1d3e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280056
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-07 18:47:23 +00:00
Aske Simon Christensen 91fe18c4e3 [dart2wasm] Skip flaky lib/async/stream_periodic3_test
Issue: https://github.com/dart-lang/sdk/issues/50901

Change-Id: Idcfa9970eaeff39ed986085f453bb176fb986243
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281100
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-02-06 12:22:28 +00:00
Srujan Gaddam 821d85e661 [dart:_js_interop] Expose a interop type for JS objects
Moves JSObject to dart:_js_helper, so that JavaScript objects
can be used with that type in the JS backends. The type then
gets reexported in dart:_js_interop with a typedef.

This is purely for experimentation. This class needs to be sealed
before we can publish this library.

Change-Id: I16093165deaa5bc5d7940eb0cb98da32c36e485a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278894
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-30 20:01:37 +00:00
Aske Simon Christensen e805b776bc [dart2wasm] Use status files for defining which tests to run
This makes it easier to run tests locally, just specifying the suites
`co19 corelib language lib web` to `test.py`.

It also make it easier to change which tests we run going forward.

Change-Id: I3a4765c18ee105055fdb9a6b59036da11b956e1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279973
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
2023-01-30 10:42:22 +00:00
Srujan Gaddam 70f1858700 Filter trusttypes_test from being run on CSP bot
Change-Id: Ie241d1eabbcb28ef4e50661a2afda2d832317c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279909
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-27 03:13:07 +00:00
Srujan Gaddam 812d26f7b1 [pkg:js] Amend lowerings tests to use @JS on all top-levels and refactory trustTypes tests out
dart2wasm does not allow top-level externals to not be annotated
with @JS, even if the library is. trustTypes also is not supported
on dart2wasm.

Change-Id: I8c1d146dcf5d9f97559e854be690bb98726513b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279757
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-01-26 21:20:27 +00:00
Srujan Gaddam 1e06e37e18 [pkg:js] Lower external static @staticInterop class members
Lowers external static class members (fields, getters, setters, methods)
on a @staticInterop class to their respective js_util transformations.
Tests are added for a non-namespaced and a namespaced library.

Change-Id: Ife0b53c05310e924ebfbcf2059f6048ae8447c2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277047
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-01-16 22:31:33 +00:00
Riley Porter b6388f2ea0 [JS interop] Expose more JavaScript operators in js_util
Exposes helper functions in js_util to access the JavaScript operators
`delete`, `||`, `&&`, `!`, `!!`, and `typeof`.
Change-Id: I0676b143aa004c7b4ed1c6b695b8d1e78a60778d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276028
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-12-17 00:31:27 +00:00
Srujan Gaddam 3bd2b4dd35 [pkg:js] Move mock tests into subfolder of export
Change-Id: I7ad17638b468dcdf749b2ea4441e7c5f5dd0a8cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264892
Reviewed-by: Riley Porter <rileyporter@google.com>
2022-10-26 16:34:38 +00:00
Srujan Gaddam 9453ff5273 [pkg:js] Add tests for export validation
Tests the various checks needed for @JSExport and createDartExport,
with and without inheritance. Also renames the mock directory to export.

Change-Id: Iae0233f1080a2f12f20b46ba1a6b30aeb36843a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260743
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-10-24 17:37:09 +00:00
Alexander Thomas 0b26f4816b [testing] Remove --compiler=none from test.py
* Use dartk as the default compiler for runtime=vm.
* Status file entries for checking for the `none` compiler now either
  use dartk or are deleted.

Tested: Standard CQ and local testing.
Fixes: https://github.com/dart-lang/sdk/issues/50241
Change-Id: I7a08d3e491ae1c82a0348fb66ea7b557398f97e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264682
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-10-19 08:09:58 +00:00
Srujan Gaddam ed38cc874d [pkg:js] Add proto argument to createStaticInteropMock
Adds optional argument proto to allow users to pass instanceof/is
checks with the generated forwarding mock.

Change-Id: If2dba386fb0e66cbe738105e58d9e5ec1f02d02a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257162
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2022-09-16 20:13:30 +00:00
Nicholas Shahan 9939ff116c [ddc] Ensure status file entries are consistent
Compilers named "dartdevc" and "dartdevk" should be listed together
at all locations. These are now aliases for the same compiler
across different configurations.

In the future these names should converge on "dartdevc".

Some skipped tests for "dartdevc" no longer need to be skipped but
currently there are no configurations are running those tests with
that compiler name so removing the skips shows no change in test
results.

Change-Id: Ieca27fbe497c4768293de125b14c694666dc8a8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253821
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-08-08 17:23:50 +00:00
Srujan Gaddam f6a3d2d5c2 [pkg:js] Transform constants and supertypes in eraser
Types in constants and supertypes need to be visited in case
they include @staticInterop types.

Fixes a bug in caching in the constant replacer.

Change-Id: Icde8b7170a8806d6a1995cad57a9788893b7772f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249441
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2022-07-18 18:24:53 +00:00
Srujan Gaddam a5cd295831 [CFE] Add 'futureValueType' to visitors/transformers
Closes https://github.com/dart-lang/sdk/issues/48835

This fixes an issue in which erasure is incomplete for
static interop types.

Change-Id: Ia2aef8c009d83df30bbb63b9c4dbb5b96e9f8e34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241820
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-04-20 21:59:10 +00:00
Riley Porter 1c74986a2a [JSinterop] Skip csp build for new tests using eval
Change-Id: Id008ebd57d7f30e1a9a7dffb0e4b48105f63357e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241805
Auto-Submit: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-04-20 18:38:38 +00:00
Ryan Macnak b6ab7350be [test] Inform status files about the new simulated architectures.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/37299
Bug: https://github.com/dart-lang/sdk/issues/38587
Change-Id: I6f1a749690b894b14f465d608f37acf62568cdef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231521
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-03 20:32:16 +00:00
Riley Porter 9fff4351cf [js_util] Fix lib status files
Change-Id: I946631781508a4364060edc6cab4e9d7e8f69ba6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230885
Auto-Submit: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-01-29 00:13:12 +00:00