Note: Const locals are still off for VM aot and dart2js for the entry points I've found in an attempt to retain the old behaviour there. It might be better if those targets could remove such locals in a whole-world analysis instead. * Keep const locals by default (except as noted above). Update the verifier to accept that. For the platforms this has increased the size by at most 6584 bytes. With this the VM will pass in any const locals as it does normal locals, but as the variable is never captured it will never pass a const local defined in a method when inside a local function in that method. * Change the dart scope calculation(s) to return the found variables instead of just the types of the found variables. * When the incremental compilers expression compilation - via the dart scope calculation - finds a const local that it wasn't told about, it will pass it on as an extra variable that it knows about, allowing for evaluating const locals in the case not covered by the first bullet. With luck this can in future CLs be extended to know about other variables that we're not told about, allowing to give a message saying something like "yes, we know what 'foo' is, but you can't currently use it" as wanted in for instance https://github.com/dart-lang/sdk/issues/60316 and https://github.com/dart-lang/sdk/issues/53996. Tested: Existing tests for existing functionality; new tests for the new Change-Id: I1ec24350273e6f81574bb2888f6bf46e3b8b1b47 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445461 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
Dart Kernel
Dart Kernel is a small high-level language derived from Dart. It is designed for use as an intermediate format for whole-program analysis and transformations, and to be consumed by codegen and execution backends.
The kernel language has an in-memory representation in Dart and can be serialized as binary or text.
Both the kernel language and its implementations are unstable and are under development.
This package contains the Dart part of the implementation and contains:
- A transformable IR for the kernel language
- Serialization of kernel code
Note: The APIs in this package are in an early state; developers should be careful about depending on this package. In particular, there is no semver contract for release versions of this package. Please depend directly on individual versions.
See ast.dart for the in-memory IR, or binary.md for a description of the binary format. For now, the textual format is very ad-hoc and cannot be parsed back in.