Skip to content

Commit 94707b6

Browse files
scheglovCommit Queue
authored andcommitted
Add 'flags' to FeatureSet.latestLanguageVersion()
Change-Id: Iebeaf74ff44c2079b319308638fa731a013fdb90 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406221 Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Bob Nystrom <[email protected]>
1 parent a6668da commit 94707b6

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

pkg/analyzer/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 7.3.0-dev
2+
* Add `flags` optional named parameter to `FeatureSet.latestLanguageVersion()`.
3+
14
## 7.2.0
25
* Add `ElementDirective` as superinterface for `LibraryExport`, `LibraryImport`,
36
and `PartInclude`. It implements `Annotatable`.

pkg/analyzer/lib/dart/analysis/features.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ abstract class FeatureSet {
136136
}) = ExperimentStatus.fromStrings2;
137137

138138
/// Computes the set of features for the latest language version known
139-
/// to the analyzer, without any experiments. Use it only if you really
140-
/// don't care which language version you want to use, and sure that the
141-
/// code that you process is valid for the latest language version.
139+
/// to the analyzer, with experiments according to [flags]. Use it only if
140+
/// you really don't care which language version you want to use, and sure
141+
/// that the code that you process is valid for the latest language version.
142142
///
143143
/// Otherwise, it is recommended to use [FeatureSet.fromEnableFlags2].
144-
factory FeatureSet.latestLanguageVersion() =
145-
ExperimentStatus.latestLanguageVersion;
144+
factory FeatureSet.latestLanguageVersion({
145+
List<String> flags,
146+
}) = ExperimentStatus.latestLanguageVersion;
146147

147148
/// Queries whether the given [feature] is contained in this feature set.
148149
bool isEnabled(Feature feature);

pkg/analyzer/lib/src/dart/analysis/experiments.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ class ExperimentStatus with _CurrentState implements FeatureSet {
9393
factory ExperimentStatus.fromStrings2({
9494
required Version sdkLanguageVersion,
9595
required List<String> flags,
96-
// TODO(scheglov): use restrictEnableFlagsToVersion
9796
}) {
9897
var explicitFlags = decodeExplicitFlags(flags);
9998

@@ -112,10 +111,12 @@ class ExperimentStatus with _CurrentState implements FeatureSet {
112111
);
113112
}
114113

115-
factory ExperimentStatus.latestLanguageVersion() {
114+
factory ExperimentStatus.latestLanguageVersion({
115+
List<String> flags = const [],
116+
}) {
116117
return ExperimentStatus.fromStrings2(
117118
sdkLanguageVersion: currentVersion,
118-
flags: [],
119+
flags: flags,
119120
);
120121
}
121122

pkg/analyzer/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: analyzer
2-
version: 7.2.0
2+
version: 7.3.0-dev
33
description: >-
44
This package provides a library that performs static analysis of Dart code.
55
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer

0 commit comments

Comments
 (0)