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

Side by Side 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: Updated to tip of tree (including danruble's change) Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/_internal/libraries.dart ('k') | utils/apidoc/apidoc.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // TODO(ahe): Long term, it would probably be better if we do not use 5 // TODO(ahe): Long term, it would probably be better if we do not use
6 // executable code to define the locations of libraries. 6 // executable code to define the locations of libraries.
7 7
8 #library('library_map'); 8 #library('library_map');
9 #import('../../../lib/_internal/libraries.dart', prefix: "libs");
10
9 /** 11 /**
10 * Simple struct holding the path to a library and an optional path 12 * Simple structure providing the path to a library and an optional path
11 * to a patch file for the library. 13 * to a patch file for the library.
12 */ 14 */
13 class LibraryInfo { 15 class LibraryInfo {
14 final String libraryPath; 16 final libs.LibraryInfo info;
15 final String patchPath; 17 const LibraryInfo(this.info);
16 18
17 /** If [:true:], the library is not part of the public API. */ 19 String get libraryPath() {
18 final bool isInternal; 20 String libPath = info.dart2jsPath;
21 if (libPath === null) libPath = info.path;
22 return "lib/$libPath";
23 }
19 24
20 const LibraryInfo(this.libraryPath, 25 String get patchPath() {
21 [this.patchPath = null, this.isInternal = false]); 26 if (info.dart2jsPatchPath === null) return null;
27 return "lib/${info.dart2jsPatchPath}";
28 }
29
30 bool get isInternal => info.category === "Internal";
22 } 31 }
23 32
24 /** 33 class Dart2JSLibraryMap {
25 * Specifies the location of Dart platform libraries. 34 const Dart2JSLibraryMap();
26 */ 35
27 const Map<String, LibraryInfo> DART2JS_LIBRARY_MAP 36 LibraryInfo operator[](String dartName) {
28 = const <String, LibraryInfo> { 37 libs.LibraryInfo info = libs.LIBRARIES[dartName];
29 "core": const LibraryInfo( 38 if (info === null) return null;
30 "lib/compiler/implementation/lib/core.dart"), 39 if (!info.isDart2JsLibrary()) {
31 "coreimpl": const LibraryInfo( 40 // Dart2js can't handle internal libraries for other backends.
32 "lib/compiler/implementation/lib/coreimpl.dart", 41 return null;
33 "lib/compiler/implementation/lib/coreimpl_patch.dart"), 42 }
34 "_js_helper": const LibraryInfo( 43 return new LibraryInfo(info);
35 "lib/compiler/implementation/lib/js_helper.dart", isInternal: true), 44 }
36 "_interceptors": const LibraryInfo( 45 }
37 "lib/compiler/implementation/lib/interceptors.dart", isInternal: true), 46
38 "crypto": const LibraryInfo( 47 final Dart2JSLibraryMap DART2JS_LIBRARY_MAP = const Dart2JSLibraryMap();
39 "lib/crypto/crypto.dart"),
40 "dom_deprecated": const LibraryInfo(
41 "lib/dom/dart2js/dom_dart2js.dart", isInternal: true),
42 "html": const LibraryInfo(
43 "lib/html/dart2js/html_dart2js.dart"),
44 "io": const LibraryInfo(
45 "lib/compiler/implementation/lib/io.dart"),
46 "isolate": const LibraryInfo(
47 "lib/isolate/isolate.dart",
48 "lib/compiler/implementation/lib/isolate_patch.dart"),
49 "json": const LibraryInfo("lib/json/json.dart"),
50 "math": const LibraryInfo(
51 "lib/math/math.dart",
52 "lib/compiler/implementation/lib/math_patch.dart", isInternal: true),
53 "uri": const LibraryInfo("lib/uri/uri.dart"),
54 "utf": const LibraryInfo("lib/utf/utf.dart"),
55 "web": const LibraryInfo("lib/web/web.dart"),
56 };
OLDNEW
« no previous file with comments | « lib/_internal/libraries.dart ('k') | utils/apidoc/apidoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698