analyzer: Remove SdkLibrary.category
Change-Id: If4f95fa1bbfb9bd120f2e26aa02d1644bad2aa63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460480
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/generated/sdk.dart b/pkg/analyzer/lib/src/generated/sdk.dart
index 74abb54..8fefc1f 100644
--- a/pkg/analyzer/lib/src/generated/sdk.dart
+++ b/pkg/analyzer/lib/src/generated/sdk.dart
@@ -182,10 +182,6 @@
/// documented.
static const String _DOCUMENTED = "documented";
- /// The name of the optional parameter used to specify the category of the
- /// library.
- static const String _CATEGORIES = "categories";
-
/// The library map that is populated by visiting the AST structure parsed
/// from the contents of the libraries file.
final LibraryMap _librariesMap = LibraryMap();
@@ -194,24 +190,6 @@
/// parsed from the contents of the libraries file.
LibraryMap get librariesMap => _librariesMap;
- // To be backwards-compatible the new categories field is translated to
- // an old approximation.
- String convertCategories(String categories) {
- switch (categories) {
- case "":
- return "Internal";
- case "Client":
- return "Client";
- case "Server":
- return "Server";
- case "Client,Server":
- return "Shared";
- case "Client,Server,Embedded":
- return "Shared";
- }
- return "Shared";
- }
-
@override
void visitMapLiteralEntry(MapLiteralEntry node) {
var key = node.key as SimpleStringLiteral;
@@ -227,10 +205,7 @@
} else if (argument is NamedExpression) {
String name = argument.name.label.name;
Expression expression = argument.expression;
- if (name == _CATEGORIES) {
- var value = (expression as StringLiteral).stringValue!;
- library.category = convertCategories(value);
- } else if (name == _IMPLEMENTATION) {
+ if (name == _IMPLEMENTATION) {
library._implementation = (expression as BooleanLiteral).value;
} else if (name == _DOCUMENTED) {
library.documented = (expression as BooleanLiteral).value;
@@ -248,9 +223,6 @@
/// Represents a single library in the SDK
abstract class SdkLibrary {
- /// Return the name of the category containing the library.
- String get category;
-
/// Return `true` if the library is documented.
bool get isDocumented;
@@ -288,12 +260,6 @@
@override
late String path;
- /// The name of the category containing the library. Unless otherwise
- /// specified in the libraries file all libraries are assumed to be shared
- /// between server and client.
- @override
- String category = "Shared";
-
/// A flag indicating whether the library is documented.
bool _documented = true;
diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
index 8c9d1be..eb6173b 100644
--- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
+++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
@@ -1388,7 +1388,7 @@
external const Symbol(String name);
}
'''),
-], categories: '');
+]);
final MockSdkLibrary _LIB_IO = MockSdkLibrary('io', [
MockSdkLibraryUnit('io/io.dart', '''
@@ -1702,7 +1702,7 @@
}
librariesBuffer.writeln(
' "${library.name}": const LibraryInfo("${library.path}", '
- 'categories: "${library.categories}"),',
+ 'categories: "Shared"),',
);
}
@@ -1729,13 +1729,9 @@
class MockSdkLibrary implements SdkLibrary {
final String name;
- final String categories;
final List<MockSdkLibraryUnit> units;
- MockSdkLibrary(this.name, this.units, {this.categories = 'Shared'});
-
- @override
- String get category => throw UnimplementedError();
+ MockSdkLibrary(this.name, this.units);
@override
bool get isDocumented => throw UnimplementedError();
diff --git a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
index 7df494a..baa608f 100644
--- a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
+++ b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
@@ -315,14 +315,12 @@
expect(libraryMap.size(), 2);
var first = libraryMap.getLibrary("dart:first")!;
expect(first, isNotNull);
- expect(first.category, "Client");
expect(first.path, "first/first.dart");
expect(first.shortName, "dart:first");
expect(first.isDocumented, true);
expect(first.isImplementation, false);
var second = libraryMap.getLibrary("dart:second")!;
expect(second, isNotNull);
- expect(second.category, "Server");
expect(second.path, "second/second.dart");
expect(second.shortName, "dart:second");
expect(second.isDocumented, false);