Index: lib/_internal/libraries.dart |
=================================================================== |
--- lib/_internal/libraries.dart (revision 11240) |
+++ lib/_internal/libraries.dart (working copy) |
@@ -5,6 +5,16 @@ |
#library('libraries'); |
/** |
+ * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js |
+ */ |
+final int DART2JS_PLATFORM = 1; |
+ |
+/** |
+ * A bit flag used by [LibraryInfo] indicating that a library is used by the VM |
+ */ |
+final int VM_PLATFORM = 2; |
+ |
+/** |
* 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 |
@@ -15,11 +25,14 @@ |
// Used by VM applications |
"builtin": const LibraryInfo( |
"builtin/builtin_runtime.dart", |
- category: "Server"), |
+ category: "Server", |
+ platforms: VM_PLATFORM), |
+ // Is moving to pkg directory |
"compiler": const LibraryInfo( |
"compiler/compiler.dart", |
- category: "Tools"), |
+ category: "Tools", |
+ platforms: 0), |
"core": const LibraryInfo( |
"core/core_runtime.dart", |
@@ -38,7 +51,7 @@ |
"dom_deprecated": const LibraryInfo( |
"dom/dom_dart2js.dart", |
dart2jsPath: "dom/dart2js/dom_dart2js.dart", |
- internal: true), |
+ documented: false), |
"html": const LibraryInfo( |
"html/html_dartium.dart", |
@@ -67,12 +80,9 @@ |
"nativewrappers": const LibraryInfo( |
"html/nativewrappers.dart", |
category: "Client", |
- implementation: true), |
+ implementation: true, |
+ platforms: VM_PLATFORM), |
keertip
2012/08/23 18:03:11
Add documented: false? Currently file shows up as
danrubel
2012/08/23 18:12:02
Good point. Done.
|
- "unittest": const LibraryInfo( |
- "unittest/unittest.dart", |
- category: "Tools"), |
- |
"uri": const LibraryInfo( |
"uri/uri.dart"), |
@@ -86,13 +96,15 @@ |
"_js_helper": const LibraryInfo( |
"compiler/implementation/lib/js_helper.dart", |
category: "Internal", |
- internal: true), |
+ documented: false, |
+ platforms: DART2JS_PLATFORM), |
// Used by dart2js |
"_interceptors": const LibraryInfo( |
"compiler/implementation/lib/interceptors.dart", |
category: "Internal", |
- internal: true), |
+ documented: false, |
+ platforms: DART2JS_PLATFORM), |
}; |
/** |
@@ -114,21 +126,29 @@ |
/** |
* Path to the dart2js library's *.dart file relative to this file |
* or null if dart2js uses the common library path defined above. |
+ * Access using the [#getDart2JsPath()] method. |
*/ |
final String dart2jsPath; |
/** |
* Path to the dart2js library's patch file relative to this file |
* or null if no dart2js patch file associated with this library. |
+ * Access using the [#getDart2JsPatchPath()] method. |
*/ |
final String dart2jsPatchPath; |
/** |
- * True if this library is internal and should not be shown to the user |
+ * True if this library is documented and should be shown to the user |
*/ |
- final bool internal; |
+ final bool documented; |
/** |
+ * Bit flags indicating which platforms consume this library |
+ * See [DART2JS_LIBRARY] and [VM_LIBRARY] |
+ */ |
+ final int platforms; |
+ |
+ /** |
* True if the library contains implementation details for another library. |
* The implication is that these libraries are less commonly used |
* and that tools like Dart Editor should not show these libraries |
@@ -137,7 +157,17 @@ |
*/ |
final bool implementation; |
- const LibraryInfo(this.path, [this.category = "Shared", |
- this.dart2jsPath, this.dart2jsPatchPath, |
- this.implementation = false, this.internal = false]); |
+ const LibraryInfo(this.path, [ |
+ this.category = "Shared", |
+ this.dart2jsPath, |
+ this.dart2jsPatchPath, |
+ this.implementation = false, |
+ this.documented = true, |
+ this.platforms = DART2JS_PLATFORM | VM_PLATFORM]); |
+ |
+ bool isDart2JsLibrary() => (platforms & DART2JS_PLATFORM) != 0; |
+ bool isVmLibrary() => (platforms & VM_PLATFORM) != 0; |
+ |
+ String getDart2JsPath() => dart2jsPath != null ? "lib/$dart2jsPath" : "lib/$path"; |
+ String getDart2jsPatchPath() => dart2jsPatchPath != null ? "lib/$dart2jsPatchPath" : null; |
} |