Skip to content

Commit 0048e78

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: Remove deprecated AnalysisContextCollectionImpl.updateAnalysisOptions2 parameter
This parameter was deprecated in analyzer 7.4.0. It's also never been public API. Change-Id: I3372c751ac1808bd6806b4312cfdcff0dd51faa7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428061 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent aebc7fd commit 0048e78

File tree

2 files changed

+7
-46
lines changed

2 files changed

+7
-46
lines changed

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

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analyzer/dart/analysis/analysis_context_collection.dart';
6-
import 'package:analyzer/dart/analysis/context_root.dart';
76
import 'package:analyzer/dart/analysis/declared_variables.dart';
87
import 'package:analyzer/file_system/file_system.dart';
98
import 'package:analyzer/file_system/physical_file_system.dart';
@@ -56,13 +55,6 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
5655
FileContentCache? fileContentCache,
5756
UnlinkedUnitStore? unlinkedUnitStore,
5857
InfoDeclarationStore? infoDeclarationStore,
59-
@Deprecated('Use updateAnalysisOptions3 instead')
60-
void Function({
61-
required AnalysisOptionsImpl analysisOptions,
62-
required ContextRoot contextRoot,
63-
required DartSdk sdk,
64-
})?
65-
updateAnalysisOptions2,
6658
void Function({
6759
required AnalysisOptionsImpl analysisOptions,
6860
required DartSdk sdk,
@@ -75,13 +67,6 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
7567

7668
performanceLog ??= PerformanceLog(null);
7769

78-
if (updateAnalysisOptions2 != null && updateAnalysisOptions3 != null) {
79-
throw ArgumentError(
80-
'Only one of updateAnalysisOptions2 and updateAnalysisOptions3 may be '
81-
'given',
82-
);
83-
}
84-
8570
if (scheduler == null) {
8671
scheduler = AnalysisDriverScheduler(performanceLog);
8772
if (drainStreams) {
@@ -112,20 +97,7 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
11297
var contextBuilder = ContextBuilderImpl(
11398
resourceProvider: this.resourceProvider,
11499
);
115-
// While users can use the deprecated `updateAnalysisOptions2` and the new
116-
// `updateAnalysisOptions3` parameter, prefer `updateAnalysisOptions3`, but
117-
// create a new closure with the signature of the old.
118-
var updateAnalysisOptions =
119-
updateAnalysisOptions3 != null
120-
? ({
121-
required AnalysisOptionsImpl analysisOptions,
122-
required ContextRoot? contextRoot,
123-
required DartSdk sdk,
124-
}) => updateAnalysisOptions3(
125-
analysisOptions: analysisOptions,
126-
sdk: sdk,
127-
)
128-
: updateAnalysisOptions2;
100+
129101
for (var root in roots) {
130102
var context = contextBuilder.createContext(
131103
byteStore: byteStore,
@@ -141,7 +113,7 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
141113
sdkPath: sdkPath,
142114
sdkSummaryPath: sdkSummaryPath,
143115
scheduler: scheduler,
144-
updateAnalysisOptions2: updateAnalysisOptions,
116+
updateAnalysisOptions3: updateAnalysisOptions3,
145117
fileContentCache: fileContentCache,
146118
unlinkedUnitStore: unlinkedUnitStore ?? UnlinkedUnitStoreImpl(),
147119
infoDeclarationStore: infoDeclarationStore,

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,9 @@ class ContextBuilderImpl {
8181
String? sdkSummaryPath,
8282
void Function({
8383
required AnalysisOptionsImpl analysisOptions,
84-
required ContextRoot contextRoot,
8584
required DartSdk sdk,
8685
})?
87-
updateAnalysisOptions2,
86+
updateAnalysisOptions3,
8887
FileContentCache? fileContentCache,
8988
UnlinkedUnitStore? unlinkedUnitStore,
9089
InfoDeclarationStore? infoDeclarationStore,
@@ -137,7 +136,7 @@ class ContextBuilderImpl {
137136
optionsFile,
138137
sourceFactory,
139138
sdk,
140-
updateAnalysisOptions2,
139+
updateAnalysisOptions3,
141140
),
142141
);
143142
} else {
@@ -146,7 +145,7 @@ class ContextBuilderImpl {
146145
analysisOptionsMap = _createOptionsMap(
147146
contextRoot,
148147
sourceFactory,
149-
updateAnalysisOptions2,
148+
updateAnalysisOptions3,
150149
sdk,
151150
);
152151
}
@@ -192,7 +191,6 @@ class ContextBuilderImpl {
192191
SourceFactory sourceFactory,
193192
void Function({
194193
required AnalysisOptionsImpl analysisOptions,
195-
required ContextRoot contextRoot,
196194
required DartSdk sdk,
197195
})?
198196
updateAnalysisOptions,
@@ -202,11 +200,7 @@ class ContextBuilderImpl {
202200

203201
void updateOptions(AnalysisOptionsImpl options) {
204202
if (updateAnalysisOptions != null) {
205-
updateAnalysisOptions(
206-
analysisOptions: options,
207-
contextRoot: contextRoot,
208-
sdk: sdk,
209-
);
203+
updateAnalysisOptions(analysisOptions: options, sdk: sdk);
210204
}
211205
}
212206

@@ -291,7 +285,6 @@ class ContextBuilderImpl {
291285
DartSdk sdk,
292286
void Function({
293287
required AnalysisOptionsImpl analysisOptions,
294-
required ContextRoot contextRoot,
295288
required DartSdk sdk,
296289
})?
297290
updateAnalysisOptions,
@@ -313,11 +306,7 @@ class ContextBuilderImpl {
313306
options ??= AnalysisOptionsImpl(file: optionsFile);
314307

315308
if (updateAnalysisOptions != null) {
316-
updateAnalysisOptions(
317-
analysisOptions: options,
318-
contextRoot: contextRoot,
319-
sdk: sdk,
320-
);
309+
updateAnalysisOptions(analysisOptions: options, sdk: sdk);
321310
}
322311

323312
return options;

0 commit comments

Comments
 (0)