eb8156415c
Change-Id: Iac3850696fb5e48dff847d17f7110644e8b8bd03 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395920 Reviewed-by: Jens Johansen <jensj@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
26 lines
1.1 KiB
Markdown
26 lines
1.1 KiB
Markdown
# Experiment flags
|
|
|
|
If you're implementing a language feature, then it needs to have an accompanying
|
|
experiment flag. (Or multiple experiments if it's going to be enabled over the
|
|
course of multiple releases.)
|
|
|
|
## Adding an experiment flag
|
|
|
|
Experiment flags are shared across all of the tools, so they are defined in a
|
|
single location. To add a new flag, edit
|
|
[`experimental_features.yaml`](https://github.com/dart-lang/sdk/blob/main/tools/experimental_features.yaml).
|
|
The initial commit is only required to define the name and to include a `help:`
|
|
key.
|
|
|
|
To generate the declarations used by the analyzer, run
|
|
`dart pkg/analyzer/tool/experiments/generate.dart`.
|
|
|
|
To generate the declarations used by the front-end, run
|
|
`dart pkg/front_end/tool/cfe.dart generate-experimental-flags`.
|
|
|
|
## Summary representation
|
|
|
|
The set of (the indexes of) enabled experiments is used to build the hash for
|
|
[summary files](summaries.md). If defining the new experiment flag changes the
|
|
indexes of existing experiment flags, then the value of the static field
|
|
`AnalysisDriver.DATA_VERSION` needs to be incremented. |