Skip to content

Commit 43dd090

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: Remove SdkLibrary.category
Change-Id: If4f95fa1bbfb9bd120f2e26aa02d1644bad2aa63 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460480 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent 66ba377 commit 43dd090

File tree

3 files changed

+4
-44
lines changed

3 files changed

+4
-44
lines changed

pkg/analyzer/lib/src/generated/sdk.dart

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,6 @@ class SdkLibrariesReader_LibraryBuilder extends RecursiveAstVisitor<void> {
182182
/// documented.
183183
static const String _DOCUMENTED = "documented";
184184

185-
/// The name of the optional parameter used to specify the category of the
186-
/// library.
187-
static const String _CATEGORIES = "categories";
188-
189185
/// The library map that is populated by visiting the AST structure parsed
190186
/// from the contents of the libraries file.
191187
final LibraryMap _librariesMap = LibraryMap();
@@ -194,24 +190,6 @@ class SdkLibrariesReader_LibraryBuilder extends RecursiveAstVisitor<void> {
194190
/// parsed from the contents of the libraries file.
195191
LibraryMap get librariesMap => _librariesMap;
196192

197-
// To be backwards-compatible the new categories field is translated to
198-
// an old approximation.
199-
String convertCategories(String categories) {
200-
switch (categories) {
201-
case "":
202-
return "Internal";
203-
case "Client":
204-
return "Client";
205-
case "Server":
206-
return "Server";
207-
case "Client,Server":
208-
return "Shared";
209-
case "Client,Server,Embedded":
210-
return "Shared";
211-
}
212-
return "Shared";
213-
}
214-
215193
@override
216194
void visitMapLiteralEntry(MapLiteralEntry node) {
217195
var key = node.key as SimpleStringLiteral;
@@ -227,10 +205,7 @@ class SdkLibrariesReader_LibraryBuilder extends RecursiveAstVisitor<void> {
227205
} else if (argument is NamedExpression) {
228206
String name = argument.name.label.name;
229207
Expression expression = argument.expression;
230-
if (name == _CATEGORIES) {
231-
var value = (expression as StringLiteral).stringValue!;
232-
library.category = convertCategories(value);
233-
} else if (name == _IMPLEMENTATION) {
208+
if (name == _IMPLEMENTATION) {
234209
library._implementation = (expression as BooleanLiteral).value;
235210
} else if (name == _DOCUMENTED) {
236211
library.documented = (expression as BooleanLiteral).value;
@@ -248,9 +223,6 @@ class SdkLibrariesReader_LibraryBuilder extends RecursiveAstVisitor<void> {
248223

249224
/// Represents a single library in the SDK
250225
abstract class SdkLibrary {
251-
/// Return the name of the category containing the library.
252-
String get category;
253-
254226
/// Return `true` if the library is documented.
255227
bool get isDocumented;
256228

@@ -288,12 +260,6 @@ class SdkLibraryImpl implements SdkLibrary {
288260
@override
289261
late String path;
290262

291-
/// The name of the category containing the library. Unless otherwise
292-
/// specified in the libraries file all libraries are assumed to be shared
293-
/// between server and client.
294-
@override
295-
String category = "Shared";
296-
297263
/// A flag indicating whether the library is documented.
298264
bool _documented = true;
299265

pkg/analyzer/lib/src/test_utilities/mock_sdk.dart

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ class Symbol implements core.Symbol {
13881388
external const Symbol(String name);
13891389
}
13901390
'''),
1391-
], categories: '');
1391+
]);
13921392

13931393
final MockSdkLibrary _LIB_IO = MockSdkLibrary('io', [
13941394
MockSdkLibraryUnit('io/io.dart', '''
@@ -1702,7 +1702,7 @@ void createMockSdk({
17021702
}
17031703
librariesBuffer.writeln(
17041704
' "${library.name}": const LibraryInfo("${library.path}", '
1705-
'categories: "${library.categories}"),',
1705+
'categories: "Shared"),',
17061706
);
17071707
}
17081708

@@ -1729,13 +1729,9 @@ void createMockSdk({
17291729

17301730
class MockSdkLibrary implements SdkLibrary {
17311731
final String name;
1732-
final String categories;
17331732
final List<MockSdkLibraryUnit> units;
17341733

1735-
MockSdkLibrary(this.name, this.units, {this.categories = 'Shared'});
1736-
1737-
@override
1738-
String get category => throw UnimplementedError();
1734+
MockSdkLibrary(this.name, this.units);
17391735

17401736
@override
17411737
bool get isDocumented => throw UnimplementedError();

pkg/analyzer/test/src/dart/sdk/sdk_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,12 @@ final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
315315
expect(libraryMap.size(), 2);
316316
var first = libraryMap.getLibrary("dart:first")!;
317317
expect(first, isNotNull);
318-
expect(first.category, "Client");
319318
expect(first.path, "first/first.dart");
320319
expect(first.shortName, "dart:first");
321320
expect(first.isDocumented, true);
322321
expect(first.isImplementation, false);
323322
var second = libraryMap.getLibrary("dart:second")!;
324323
expect(second, isNotNull);
325-
expect(second.category, "Server");
326324
expect(second.path, "second/second.dart");
327325
expect(second.shortName, "dart:second");
328326
expect(second.isDocumented, false);

0 commit comments

Comments
 (0)