Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(663)

Unified Diff: lib/compiler/implementation/library_map.dart

Issue 10874030: Get library data from lib/_internal/libraries.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Now made apidoc use the libraries.dart file directly. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/library_map.dart
diff --git a/lib/compiler/implementation/library_map.dart b/lib/compiler/implementation/library_map.dart
index b852fb543c9dcd873140990f9f7e37c92ade89fa..9ffc4a41327d4a160f74d2ce7ab041766747ab74 100644
--- a/lib/compiler/implementation/library_map.dart
+++ b/lib/compiler/implementation/library_map.dart
@@ -6,51 +6,42 @@
// executable code to define the locations of libraries.
#library('library_map');
+#import('../../../lib/_internal/libraries.dart', prefix: "libs");
+
/**
- * Simple struct holding the path to a library and an optional path
+ * Simple structure providing the path to a library and an optional path
* to a patch file for the library.
*/
class LibraryInfo {
- final String libraryPath;
- final String patchPath;
+ final libs.LibraryInfo info;
+ const LibraryInfo(this.info);
+
+ String get libraryPath() {
+ String libPath = info.dart2jsPath;
+ if (libPath === null) libPath = info.path;
+ return "lib/$libPath";
+ }
- /** If [:true:], the library is not part of the public API. */
- final bool isInternal;
+ String get patchPath() {
+ if (info.dart2jsPatchPath === null) return null;
+ return "lib/${info.dart2jsPatchPath}";
+ }
- const LibraryInfo(this.libraryPath,
- [this.patchPath = null, this.isInternal = false]);
+ bool get isInternal => info.category === "Internal";
}
-/**
- * Specifies the location of Dart platform libraries.
- */
-final Map<String, LibraryInfo> DART2JS_LIBRARY_MAP
- = const <String, LibraryInfo> {
- "core": const LibraryInfo(
- "lib/compiler/implementation/lib/core.dart"),
- "coreimpl": const LibraryInfo(
- "lib/compiler/implementation/lib/coreimpl.dart",
- "lib/compiler/implementation/lib/coreimpl_patch.dart"),
- "_js_helper": const LibraryInfo(
- "lib/compiler/implementation/lib/js_helper.dart", isInternal: true),
- "_interceptors": const LibraryInfo(
- "lib/compiler/implementation/lib/interceptors.dart", isInternal: true),
- "crypto": const LibraryInfo(
- "lib/crypto/crypto.dart"),
- "dom_deprecated": const LibraryInfo(
- "lib/dom/dart2js/dom_dart2js.dart", isInternal: true),
- "html": const LibraryInfo(
- "lib/html/dart2js/html_dart2js.dart"),
- "io": const LibraryInfo(
- "lib/compiler/implementation/lib/io.dart"),
- "isolate": const LibraryInfo(
- "lib/isolate/isolate.dart",
- "lib/compiler/implementation/lib/isolate_patch.dart"),
- "json": const LibraryInfo("lib/json/json.dart"),
- "math": const LibraryInfo(
- "lib/math/math.dart",
- "lib/compiler/implementation/lib/math_patch.dart", isInternal: true),
- "uri": const LibraryInfo("lib/uri/uri.dart"),
- "utf": const LibraryInfo("lib/utf/utf.dart"),
- "web": const LibraryInfo("lib/web/web.dart"),
-};
+class Dart2JSLibraryMap {
+ const Dart2JSLibraryMap();
+
+ LibraryInfo operator[](String dartName) {
+ libs.LibraryInfo info = libs.LIBRARIES[dartName];
+ if (info === null) return null;
+ if (info.internalFor !== null && info.internalFor !== "dart2js") {
+ // Dart2js can't handle internal libraries for other backends.
+ return null;
+ }
+ return new LibraryInfo(info);
+ }
+}
+
+final Dart2JSLibraryMap DART2JS_LIBRARY_MAP = const Dart2JSLibraryMap();

Powered by Google App Engine
This is Rietveld 408576698