Function type parameters in occurring in constants were using an offset based on the context in which the constant first occurred. This meant that function type parameters occurring in a generic context would have a different offset that those occurring in a non-generic context. The loading of .dill in ast_from_binary would read all constants outside the context and would therefore get the indices wrong on generic function types. This CL changes the encoding of these type parameters to always use a fresh context. Closes #45415 TEST=pkg/front_end/testcases/generic_metadata/from_dill/main.dart Change-Id: Ifdaedb4581f1e022c908fc58a58ceac3d7b0900e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193481 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Reviewed-by: Alexander Markov <alexmarkov@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.