commit | ca3e67a3b654c492b85b546354619137d1f2f95d | [log] [tgz] |
---|---|---|
author | Mayank Patke <fishythefish@google.com> | Wed Jun 12 21:28:23 2024 +0000 |
committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Jun 12 21:28:23 2024 +0000 |
tree | 08fac432a92dbdc43df8d230fbf038994f258309 | |
parent | bb66bd92c81905b4a610130c7be3f4e0dc99cfdb [diff] |
[dart2js] Add --interop-null-assertions. This CL adds a new --interop-null-assertions flag (cf. --native-null-assertions) with the goal of validating that JS interop APIs with non-nullable static return types do not return null values. This flag is currently disabled by default but is intended to assist in sound null safety migrations. In general, we don't guarantee type soundness of package:js interop since users can write incorrect static types which are not backed by any runtime checks. However, it is likely that during the null safety migration, some interop APIs which should have been made nullable weren't. Therefore, we want to offer some additional (but limited) checking for this case. For static invocations of functions with non-nullable return types, we can simply perform a null check on the result of the call. For instance methods (which could be invoked virtually/dynamically), we want to perform a null check on the return value in the callee (the interceptor method) itself when possible. It's possible for multiple interop bindings to share the same interceptor method. We produce a null check in the interceptor method body if all the methods have non-nullable return types. Otherwise, we insert checks at callsites when appropriate. Change-Id: Ifd155d7f8326152b6d57d61199e0b7973c4a1211 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369784 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Mayank Patke <fishythefish@google.com>
Dart is:
Approachable: Develop with a strongly typed programming language that is consistent, concise, and offers modern language features like null safety and patterns.
Portable: Compile to ARM, x64, or RISC-V machine code for mobile, desktop, and backend. Compile to JavaScript or WebAssembly for the web.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app. Diagnose app issues using DevTools.
Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).
Dart is free and open source.
See LICENSE and PATENT_GRANT.
Visit dart.dev to learn more about the language, tools, and to find codelabs.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents in our repo at docs.
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.
Future plans for Dart are included in the combined Dart and Flutter roadmap on the Flutter wiki.