dart-sdk/sdk
Srujan Gaddam 1d28f8e821 [dart:js_interop/ddc/dart2js] Implement JS types using @staticInterop
Currently, dart:_js_types types are all typedefs in the web backends.
This leads to inconsistent semantics, since you can statically pass
Strings to JSString, for example. You cannot do this in dart2wasm.
In order to ensure consistent semantics, we reify these types using
a custom @staticInterop lowering. They all get erased to their
respective Dart type. When we have inline classes, these types
should be implemented using inline classes.

Note that Interceptor will not work for this use case. The reified
type of JS primitives are Dart types e.g. String, bool, and therefore
can not be casted to Interceptor.

In order to do this, the eraser is refactored and the JS backends use
shared erasure code to either erase/emit types.

Tests are added to make sure you need to go through a conversion or
cast to pass Dart objects to JS types.

CoreLibraryReviewExempt: Backend-specific internal library changes.
Change-Id: I5942be628102919ec167f094cfe10fced606363c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295105
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-04-26 15:55:54 +00:00
..
bin [dart2js] Update build infrastructure to move Dart2JS onto sound null safety. 2023-02-22 17:19:43 +00:00
lib [dart:js_interop/ddc/dart2js] Implement JS types using @staticInterop 2023-04-26 15:55:54 +00:00
.gitignore [sdk] Generate a version file for the unpatched SDK 2022-05-05 10:36:05 +00:00
api_readme.md [SDK docs] update the SDK's API doc readme file 2023-04-04 00:25:44 +00:00
BUILD.gn [dart2wasm] Rename the dart:wasm library to dart:_wasm. 2023-04-04 11:52:18 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00