Index: sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart |
diff --git a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart |
index e304873189f17a3b4f1c6d356fefded20eec47cc..9678dac540c2dd2f7a0b29fa6d8016f095d2cba4 100644 |
--- a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart |
+++ b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart |
@@ -14,80 +14,60 @@ const int DART2JS_PLATFORM = 1; |
*/ |
const int VM_PLATFORM = 2; |
-/// The contexts that a library can be used from. |
-enum Category { |
- /// Indicates that a library can be used in a browser context. |
- client, |
- /// Indicates that a library can be used in a command line context. |
- server, |
- /// Indicates that a library can be used from embedded devices. |
- embedded |
-} |
- |
-Category parseCategory(String name) { |
- switch (name) { |
- case "Client": return Category.client; |
- case "Server": return Category.server; |
- case "Embedded": return Category.embedded; |
- } |
- return null; |
-} |
- |
-/// Mapping of "dart:" library name (e.g. "core") to information about that |
-/// library. |
-const Map<String, LibraryInfo> libraries = const { |
+/** |
+ * Mapping of "dart:" library name (e.g. "core") to information about that library. |
+ * This information is structured such that Dart Editor can parse this file |
+ * and extract the necessary information without executing it |
+ * while other tools can access via execution. |
+ */ |
+const Map<String, LibraryInfo> LIBRARIES = const { |
"async": const LibraryInfo( |
"async/async.dart", |
- categories: "Client,Server", |
maturity: Maturity.STABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"), |
"_blink": const LibraryInfo( |
"_blink/dartium/_blink_dartium.dart", |
- categories: "Client", |
+ category: "Client", |
implementation: true, |
documented: false, |
platforms: VM_PLATFORM), |
"_chrome": const LibraryInfo( |
"_chrome/dart2js/chrome_dart2js.dart", |
- categories: "Client", |
- documented: false), |
+ documented: false, |
+ category: "Client"), |
"collection": const LibraryInfo( |
"collection/collection.dart", |
- categories: "Client,Server,Embedded", |
maturity: Maturity.STABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/collection_patch.dart"), |
"convert": const LibraryInfo( |
"convert/convert.dart", |
- categories: "Client,Server", |
maturity: Maturity.STABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/convert_patch.dart"), |
"core": const LibraryInfo( |
"core/core.dart", |
- categories: "Client,Server,Embedded", |
maturity: Maturity.STABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/core_patch.dart"), |
"developer": const LibraryInfo( |
"developer/developer.dart", |
- categories: "Client,Server,Embedded", |
maturity: Maturity.UNSTABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"), |
"html": const LibraryInfo( |
"html/dartium/html_dartium.dart", |
- categories: "Client", |
+ category: "Client", |
maturity: Maturity.WEB_STABLE, |
dart2jsPath: "html/dart2js/html_dart2js.dart"), |
"html_common": const LibraryInfo( |
"html/html_common/html_common.dart", |
- categories: "Client", |
+ category: "Client", |
maturity: Maturity.WEB_STABLE, |
dart2jsPath: "html/html_common/html_common_dart2js.dart", |
documented: false, |
@@ -95,129 +75,126 @@ const Map<String, LibraryInfo> libraries = const { |
"indexed_db": const LibraryInfo( |
"indexed_db/dartium/indexed_db_dartium.dart", |
- categories: "Client", |
+ category: "Client", |
maturity: Maturity.WEB_STABLE, |
dart2jsPath: "indexed_db/dart2js/indexed_db_dart2js.dart"), |
"io": const LibraryInfo( |
"io/io.dart", |
- categories: "Server", |
+ category: "Server", |
+ maturity: Maturity.STABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/io_patch.dart"), |
"isolate": const LibraryInfo( |
"isolate/isolate.dart", |
- categories: "Client,Server", |
maturity: Maturity.STABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/isolate_patch.dart"), |
"js": const LibraryInfo( |
"js/dartium/js_dartium.dart", |
- categories: "Client", |
+ category: "Client", |
maturity: Maturity.STABLE, |
dart2jsPath: "js/dart2js/js_dart2js.dart"), |
"math": const LibraryInfo( |
"math/math.dart", |
- categories: "Client,Server,Embedded", |
maturity: Maturity.STABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/math_patch.dart"), |
"mirrors": const LibraryInfo( |
"mirrors/mirrors.dart", |
- categories: "Client,Server", |
maturity: Maturity.UNSTABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/mirrors_patch.dart"), |
"nativewrappers": const LibraryInfo( |
"html/dartium/nativewrappers.dart", |
- categories: "Client", |
+ category: "Client", |
implementation: true, |
documented: false, |
platforms: VM_PLATFORM), |
"typed_data": const LibraryInfo( |
"typed_data/typed_data.dart", |
- categories: "Client,Server,Embedded", |
maturity: Maturity.STABLE, |
dart2jsPatchPath: "_internal/js_runtime/lib/typed_data_patch.dart"), |
"_native_typed_data": const LibraryInfo( |
"_internal/js_runtime/lib/native_typed_data.dart", |
- categories: "", |
+ category: "Internal", |
implementation: true, |
documented: false, |
platforms: DART2JS_PLATFORM), |
"svg": const LibraryInfo( |
"svg/dartium/svg_dartium.dart", |
- categories: "Client", |
+ category: "Client", |
maturity: Maturity.WEB_STABLE, |
dart2jsPath: "svg/dart2js/svg_dart2js.dart"), |
"web_audio": const LibraryInfo( |
"web_audio/dartium/web_audio_dartium.dart", |
- categories: "Client", |
+ category: "Client", |
maturity: Maturity.WEB_STABLE, |
dart2jsPath: "web_audio/dart2js/web_audio_dart2js.dart"), |
"web_gl": const LibraryInfo( |
"web_gl/dartium/web_gl_dartium.dart", |
- categories: "Client", |
+ category: "Client", |
maturity: Maturity.WEB_STABLE, |
dart2jsPath: "web_gl/dart2js/web_gl_dart2js.dart"), |
"web_sql": const LibraryInfo( |
"web_sql/dartium/web_sql_dartium.dart", |
- categories: "Client", |
+ category: "Client", |
maturity: Maturity.WEB_STABLE, |
dart2jsPath: "web_sql/dart2js/web_sql_dart2js.dart"), |
"_internal": const LibraryInfo( |
"internal/internal.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
dart2jsPatchPath: |
"_internal/js_runtime/lib/internal_patch.dart"), |
"_js_helper": const LibraryInfo( |
"_internal/js_runtime/lib/js_helper.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
"_interceptors": const LibraryInfo( |
"_internal/js_runtime/lib/interceptors.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
"_foreign_helper": const LibraryInfo( |
"_internal/js_runtime/lib/foreign_helper.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
"_isolate_helper": const LibraryInfo( |
"_internal/js_runtime/lib/isolate_helper.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
"_js_mirrors": const LibraryInfo( |
"_internal/js_runtime/lib/js_mirrors.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
"_js_names": const LibraryInfo( |
"_internal/js_runtime/lib/js_names.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
"_js_primitives": const LibraryInfo( |
"_internal/js_runtime/lib/js_primitives.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
@@ -225,25 +202,25 @@ const Map<String, LibraryInfo> libraries = const { |
// different platform. |
"_mirror_helper": const LibraryInfo( |
"_internal/js_runtime/lib/mirror_helper.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
"_js_embedded_names": const LibraryInfo( |
"_internal/js_runtime/lib/shared/embedded_names.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
"_async_await_error_codes": const LibraryInfo( |
"_internal/js_runtime/lib/shared/async_await_error_codes.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
"_metadata": const LibraryInfo( |
"html/html_common/metadata.dart", |
- categories: "", |
+ category: "Internal", |
documented: false, |
platforms: DART2JS_PLATFORM), |
}; |
@@ -259,10 +236,11 @@ class LibraryInfo { |
final String path; |
/** |
- * The categories in which the library can be used encoded as a |
- * comma-separated String. |
+ * The category in which the library should appear in the editor |
+ * (e.g. "Shared", "Client", "Server", ...). |
+ * If a category is not specified it defaults to "Shared". |
*/ |
- final String _categories; |
+ final String category; |
/** |
* Path to the dart2js library's *.dart file relative to this file |
@@ -304,38 +282,16 @@ class LibraryInfo { |
final Maturity maturity; |
const LibraryInfo(this.path, { |
- String categories: "", |
+ this.category: "Shared", |
this.dart2jsPath, |
this.dart2jsPatchPath, |
this.implementation: false, |
this.documented: true, |
this.maturity: Maturity.UNSPECIFIED, |
- this.platforms: DART2JS_PLATFORM | VM_PLATFORM}) |
- : _categories = categories; |
+ this.platforms: DART2JS_PLATFORM | VM_PLATFORM}); |
bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0; |
bool get isVmLibrary => (platforms & VM_PLATFORM) != 0; |
- |
- /** |
- * The categories in which the library can be used. |
- * |
- * If no categories are specified, the library is internal and can not be |
- * loaded by user code. |
- */ |
- List<Category> get categories { |
- // `"".split(,)` returns [""] not [], so we handle that case separately. |
- if (_categories == "") return const <Category>[]; |
- return _categories.split(",").map(parseCategory).toList(); |
- } |
- |
- bool get isInternal => categories.isEmpty; |
- |
- /// The original "categories" String that was passed to the constructor. |
- /// |
- /// Can be used to construct a slightly modified copy of this LibraryInfo. |
- String get categoriesString { |
- return _categories; |
- } |
} |