| commit | d150ad8a812137f0cffe8ed30ce6d22958dff7e3 | [log] [tgz] |
|---|---|---|
| author | Martin Kustermann <kustermann@google.com> | Thu Jun 13 13:10:50 2024 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Jun 13 13:10:50 2024 +0000 |
| tree | 372e2e2c7f807237af67054b20fc330aa740a03e | |
| parent | d289a725a3a9a0aa427716b414c3105aafca3617 [diff] |
[dart2wasm] Move local constant variable to top-level The flutter platform file is compiled slightly differently from the way we compile the normal SDK platform file. This slight difference - somehow related to how -D environments are used in CFE - results in a constant `VariableDeclaration` to stay in the kernel in flutter's case but not in the Dart SDK's case. (All usages of constant variables / fields will be `ConstantExpression(<const>)` instead of `VariableGet(<constant-variable>)`) That in itself causes the kernel verifier AST visitor (which we call from `pkg/dart2wasm/lib/compile.dart` in assertion mode enabled) to report an error. => To work around this issue we hoist the only variable affected by this to top-level. => That will allow us to run the dart2wasm compiler in assertions mode on flutter apps without hitting the verifier problem. (This has very likely to do with the fact that in flutter's case the variable must result in an `UnevaluatedConstant` which then at a later stage gets evaluated whereas in Dart's case we do that eagerly). There's no easy way to write a test for this, as normal test files will have an environment and therefore don't result in unevaluated constants afaik. Change-Id: I883b91bdc37ede8b45e35a15d0dddc296d9da9ba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371340 Reviewed-by: Ömer Ağacan <omersa@google.com> Commit-Queue: Martin Kustermann <kustermann@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.