Skip to content

Commit 0a63d6c

Browse files
committed
Removed deprecated methods.
1 parent 0a7929c commit 0a63d6c

File tree

4 files changed

+1
-169
lines changed

4 files changed

+1
-169
lines changed

build/lib/src/analyzer/resolver.dart

-61
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,6 @@ abstract class Resolver {
2929
/// instance because due to imports or exports.
3030
Stream<LibraryElement2> get libraries;
3131

32-
/// All libraries resolved by this resolver.
33-
///
34-
/// This includes the following libraries:
35-
/// - The primary input of this resolver (in other words, the
36-
/// [BuildStep.inputId] of a build step).
37-
/// - Libraries resolved with a direct [libraryFor] call.
38-
/// - Every public `dart:` library part of the SDK.
39-
/// - All libraries recursively accessible from the mentioned sources, for
40-
/// instance because due to imports or exports.
41-
@Deprecated('use libraries')
42-
Stream<LibraryElement2> get libraries2;
43-
4432
/// Returns the parsed [AstNode] for [Fragment].
4533
///
4634
/// This should always be preferred over using the [AnalysisSession]
@@ -54,20 +42,6 @@ abstract class Resolver {
5442
/// reason.
5543
Future<AstNode?> astNodeFor(Fragment fragment, {bool resolve = false});
5644

57-
/// Returns the parsed [AstNode] for [Fragment].
58-
///
59-
/// This should always be preferred over using the [AnalysisSession]
60-
/// directly, because it avoids [InconsistentAnalysisException] issues.
61-
///
62-
/// If [resolve] is `true` then you will get a resolved ast node, otherwise
63-
/// it will only be a parsed ast node.
64-
///
65-
/// Returns `null` if the ast node can not be found. This can happen if an
66-
/// element is coming from a summary, or is unavailable for some other
67-
/// reason.
68-
@Deprecated('use astNodeFor')
69-
Future<AstNode?> astNodeFor2(Fragment element, {bool resolve = false});
70-
7145
/// Returns a parsed AST structor representing the file defined in [assetId].
7246
///
7347
/// * If the [assetId] has syntax errors, and [allowSyntaxErrors] is set to
@@ -90,17 +64,6 @@ abstract class Resolver {
9064
bool allowSyntaxErrors = false,
9165
});
9266

93-
/// Returns a resolved library representing the file defined in [assetId].
94-
///
95-
/// * Throws [NonLibraryAssetException] if [assetId] is not a Dart library.
96-
/// * If the [assetId] has syntax errors, and [allowSyntaxErrors] is set to
97-
/// `false` (the default), throws a [SyntaxErrorInAssetException].
98-
@Deprecated('use libraryFor')
99-
Future<LibraryElement2> libraryFor2(
100-
AssetId assetId, {
101-
bool allowSyntaxErrors = false,
102-
});
103-
10467
/// Returns the first resolved library identified by [libraryName].
10568
///
10669
/// A library is resolved if it's recursively accessible from the entry point
@@ -113,19 +76,6 @@ abstract class Resolver {
11376
/// being unique.
11477
Future<LibraryElement2?> findLibraryByName(String libraryName);
11578

116-
/// Returns the first resolved library identified by [libraryName].
117-
///
118-
/// A library is resolved if it's recursively accessible from the entry point
119-
/// or subsequent calls to [libraryFor]. In other words, this searches for
120-
/// libraries in [libraries].
121-
/// If no library can be found, returns `null`.
122-
///
123-
/// **NOTE**: In general, its recommended to use [libraryFor] with an absolute
124-
/// asset id instead of a named identifier that has the possibility of not
125-
/// being unique.
126-
@Deprecated('use findLibraryByName')
127-
Future<LibraryElement2?> findLibraryByName2(String libraryName);
128-
12979
/// Returns the [AssetId] of the Dart library or part declaring [element].
13080
///
13181
/// If [element] is defined in the SDK or in a summary throws
@@ -135,17 +85,6 @@ abstract class Resolver {
13585
/// The returned asset is not necessarily the asset that should be imported to
13686
/// use the element, it may be a part file instead of the library.
13787
Future<AssetId> assetIdForElement(Element2 element);
138-
139-
/// Returns the [AssetId] of the Dart library or part declaring [element].
140-
///
141-
/// If [element] is defined in the SDK or in a summary throws
142-
/// `UnresolvableAssetException`, although a non-throwing return here does not
143-
/// guarantee that the asset is readable.
144-
///
145-
/// The returned asset is not necessarily the asset that should be imported to
146-
/// use the element, it may be a part file instead of the library.
147-
@Deprecated('use assetIdForElement')
148-
Future<AssetId> assetIdForElement2(Element2 element);
14988
}
15089

15190
/// A resolver that should be manually released at the end of a build step.

build/lib/src/builder/build_step.dart

-16
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,6 @@ abstract class BuildStep implements AssetReader, AssetWriter {
3939
/// ```
4040
Future<LibraryElement2> get inputLibrary;
4141

42-
/// Resolved library defined by [inputId].
43-
///
44-
/// Throws [NonLibraryAssetException] if [inputId] is not a Dart library file.
45-
/// Throws [SyntaxErrorInAssetException] if [inputId] contains syntax errors.
46-
/// If you want to support libraries with syntax errors, resolve the library
47-
/// manually instead of using [inputLibrary]:
48-
/// ```dart
49-
/// Future<void> build(BuildStep step) async {
50-
/// // Resolve the input library, allowing syntax errors
51-
/// final inputLibrary =
52-
/// await step.resolver.libraryFor(step.inputId, allowSyntaxErrors: true);
53-
/// }
54-
/// ```
55-
@Deprecated('use inputLibrary')
56-
Future<LibraryElement2> get inputLibrary2;
57-
5842
/// Gets an instance provided by [resource] which is guaranteed to be unique
5943
/// within a single build, and may be reused across build steps within a
6044
/// build if the implementation allows.

build/lib/src/builder/build_step_impl.dart

-31
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ class BuildStepImpl implements BuildStep {
3939
return resolver.libraryFor(inputId);
4040
}
4141

42-
@Deprecated('use inputLibrary')
43-
@override
44-
Future<LibraryElement2> get inputLibrary2 => inputLibrary;
45-
4642
/// The list of all outputs which are expected/allowed to be output from this
4743
/// step.
4844
@override
@@ -236,22 +232,13 @@ class _DelayedResolver implements Resolver {
236232
return completer.stream;
237233
}
238234

239-
@Deprecated('use libraries')
240-
@override
241-
Stream<LibraryElement2> get libraries2 => libraries;
242-
243235
@override
244236
Future<AstNode?> astNodeFor(
245237
Fragment fragment, {
246238
bool resolve = false,
247239
}) async =>
248240
(await _delegate).astNodeFor(fragment, resolve: resolve);
249241

250-
@Deprecated('use astNodeFor')
251-
@override
252-
Future<AstNode?> astNodeFor2(Fragment fragment, {bool resolve = false}) =>
253-
astNodeFor(fragment, resolve: resolve);
254-
255242
@override
256243
Future<CompilationUnit> compilationUnitFor(
257244
AssetId assetId, {
@@ -272,29 +259,11 @@ class _DelayedResolver implements Resolver {
272259
allowSyntaxErrors: allowSyntaxErrors,
273260
);
274261

275-
@Deprecated('use libraryFor')
276-
@override
277-
Future<LibraryElement2> libraryFor2(
278-
AssetId assetId, {
279-
bool allowSyntaxErrors = false,
280-
}) async =>
281-
libraryFor(assetId, allowSyntaxErrors: allowSyntaxErrors);
282-
283262
@override
284263
Future<LibraryElement2?> findLibraryByName(String libraryName) async =>
285264
(await _delegate).findLibraryByName(libraryName);
286265

287-
@Deprecated('use findLibraryByName')
288-
@override
289-
Future<LibraryElement2?> findLibraryByName2(String libraryName) async =>
290-
findLibraryByName(libraryName);
291-
292266
@override
293267
Future<AssetId> assetIdForElement(Element2 element) async =>
294268
(await _delegate).assetIdForElement(element);
295-
296-
@Deprecated('use assetIdForElement')
297-
@override
298-
Future<AssetId> assetIdForElement2(Element2 element) async =>
299-
assetIdForElement(element);
300269
}

build_resolvers/lib/src/resolver.dart

+1-61
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,10 @@ class PerActionResolver implements ReleasableResolver {
8787

8888
@override
8989
Stream<LibraryElement2> get libraries async* {
90-
yield* _delegate.sdkLibraries2;
90+
yield* _delegate.sdkLibraries;
9191
yield* _librariesFromEntrypoints.where((library) => !library.isInSdk);
9292
}
9393

94-
@Deprecated('use libraries instead')
95-
@override
96-
Stream<LibraryElement2> get libraries2 => libraries;
97-
9894
@override
9995
Future<LibraryElement2?> findLibraryByName(String libraryName) async {
10096
return _step.trackStage('findLibraryByName $libraryName', () async {
@@ -105,11 +101,6 @@ class PerActionResolver implements ReleasableResolver {
105101
});
106102
}
107103

108-
@Deprecated('use findLibraryByName instead')
109-
@override
110-
Future<LibraryElement2?> findLibraryByName2(String libraryName) =>
111-
findLibraryByName(libraryName);
112-
113104
@override
114105
Future<bool> isLibrary(AssetId assetId) =>
115106
_step.trackStage('isLibrary $assetId', () async {
@@ -125,11 +116,6 @@ class PerActionResolver implements ReleasableResolver {
125116
() => _delegate.astNodeFor(fragment, resolve: resolve),
126117
);
127118

128-
@Deprecated('use astNodeFor instead')
129-
@override
130-
Future<AstNode?> astNodeFor2(Fragment fragment, {bool resolve = false}) =>
131-
astNodeFor(fragment, resolve: resolve);
132-
133119
@override
134120
Future<CompilationUnit> compilationUnitFor(
135121
AssetId assetId, {
@@ -163,14 +149,6 @@ class PerActionResolver implements ReleasableResolver {
163149
});
164150
}
165151

166-
@Deprecated('use libraryFor instead')
167-
@override
168-
Future<LibraryElement2> libraryFor2(
169-
AssetId assetId, {
170-
bool allowSyntaxErrors = false,
171-
}) =>
172-
libraryFor(assetId, allowSyntaxErrors: allowSyntaxErrors);
173-
174152
// Ensures we only resolve one entrypoint at a time from the same build step,
175153
// otherwise there are race conditions with `_entryPoints` being updated
176154
// before it is actually ready, or resolving entrypoints more than once.
@@ -218,11 +196,6 @@ class PerActionResolver implements ReleasableResolver {
218196
@override
219197
Future<AssetId> assetIdForElement(Element2 element) =>
220198
_delegate.assetIdForElement(element);
221-
222-
@Deprecated('use assetIdForElement instead')
223-
@override
224-
Future<AssetId> assetIdForElement2(Element2 element) =>
225-
assetIdForElement(element);
226199
}
227200

228201
class AnalyzerResolver implements ReleasableResolver {
@@ -283,11 +256,6 @@ class AnalyzerResolver implements ReleasableResolver {
283256
});
284257
}
285258

286-
@Deprecated('use astNodeFor instead')
287-
@override
288-
Future<AstNode?> astNodeFor2(Fragment fragment, {bool resolve = false}) =>
289-
astNodeFor(fragment, resolve: resolve);
290-
291259
@override
292260
Future<CompilationUnit> compilationUnitFor(
293261
AssetId assetId, {
@@ -344,14 +312,6 @@ class AnalyzerResolver implements ReleasableResolver {
344312
return library.element2;
345313
}
346314

347-
@Deprecated('use libraryFor instead')
348-
@override
349-
Future<LibraryElement2> libraryFor2(
350-
AssetId assetId, {
351-
bool allowSyntaxErrors = false,
352-
}) =>
353-
libraryFor(assetId, allowSyntaxErrors: allowSyntaxErrors);
354-
355315
/// Finds syntax errors in files related to the [element].
356316
///
357317
/// This includes the main library and existing part files.
@@ -398,10 +358,6 @@ class AnalyzerResolver implements ReleasableResolver {
398358
throw UnimplementedError();
399359
}
400360

401-
@Deprecated('use libraries instead')
402-
@override
403-
Stream<LibraryElement2> get libraries2 => libraries;
404-
405361
Stream<LibraryElement2> get sdkLibraries {
406362
final loadLibraries = _sdkLibraries ??= Future.sync(() {
407363
final publicSdkUris = _driver.sdkLibraryUris.where(
@@ -422,24 +378,13 @@ class AnalyzerResolver implements ReleasableResolver {
422378
return Stream.fromFuture(loadLibraries).expand((libraries) => libraries);
423379
}
424380

425-
@Deprecated('use sdkLibraries instead')
426-
Stream<LibraryElement2> get sdkLibraries2 => sdkLibraries;
427-
428381
@override
429382
Future<LibraryElement2?> findLibraryByName(String libraryName) async {
430383
// We don't know what libraries to expose without leaking libraries written
431384
// by later phases.
432385
throw UnimplementedError();
433386
}
434387

435-
@Deprecated('use findLibraryByName instead')
436-
@override
437-
Future<LibraryElement2?> findLibraryByName2(String libraryName) async {
438-
// We don't know what libraries to expose without leaking libraries written
439-
// by later phases.
440-
throw UnimplementedError();
441-
}
442-
443388
@override
444389
Future<AssetId> assetIdForElement(Element2 element) async {
445390
if (element is MultiplyDefinedElement2) {
@@ -459,11 +404,6 @@ class AnalyzerResolver implements ReleasableResolver {
459404
}
460405
return AssetId.resolve(source.uri);
461406
}
462-
463-
@Deprecated('use assetIdForElement instead')
464-
@override
465-
Future<AssetId> assetIdForElement2(Element2 element) =>
466-
assetIdForElement(element);
467407
}
468408

469409
class AnalyzerResolvers implements Resolvers {

0 commit comments

Comments
 (0)