OLD | NEW |
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 #library('libraries'); | 5 #library('libraries'); |
6 | 6 |
7 /** | 7 /** |
8 * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js | 8 * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js |
9 */ | 9 */ |
10 const int DART2JS_PLATFORM = 1; | 10 const int DART2JS_PLATFORM = 1; |
11 | 11 |
12 /** | 12 /** |
13 * A bit flag used by [LibraryInfo] indicating that a library is used by the VM | 13 * A bit flag used by [LibraryInfo] indicating that a library is used by the VM |
14 */ | 14 */ |
15 const int VM_PLATFORM = 2; | 15 const int VM_PLATFORM = 2; |
16 | 16 |
17 /** | 17 /** |
18 * Mapping of "dart:" library name (e.g. "core") to information about that libra
ry. | 18 * Mapping of "dart:" library name (e.g. "core") to information about that libra
ry. |
19 * This information is structured such that Dart Editor can parse this file | 19 * This information is structured such that Dart Editor can parse this file |
20 * and extract the necessary information without executing it | 20 * and extract the necessary information without executing it |
21 * while other tools can access via execution. | 21 * while other tools can access via execution. |
22 */ | 22 */ |
23 const Map<String, LibraryInfo> LIBRARIES = const <LibraryInfo> { | 23 const Map<String, LibraryInfo> LIBRARIES = const <LibraryInfo> { |
24 | 24 |
25 "builtin": const LibraryInfo( | 25 "builtin": const LibraryInfo( |
26 "builtin/builtin_runtime.dart", | 26 "builtin/builtin_runtime.dart", |
27 category: "Server", | 27 category: "Server", |
| 28 documented: false, |
28 platforms: VM_PLATFORM), | 29 platforms: VM_PLATFORM), |
29 | 30 |
30 // Is moving to pkg directory | |
31 "compiler": const LibraryInfo( | |
32 "compiler/compiler.dart", | |
33 category: "Tools", | |
34 platforms: 0), | |
35 | |
36 "core": const LibraryInfo( | 31 "core": const LibraryInfo( |
37 "core/core_runtime.dart", | 32 "core/core_runtime.dart", |
38 dart2jsPath: "compiler/implementation/lib/core.dart"), | 33 dart2jsPath: "compiler/implementation/lib/core.dart"), |
39 | 34 |
40 "coreimpl": const LibraryInfo( | 35 "coreimpl": const LibraryInfo( |
41 "coreimpl/coreimpl_runtime.dart", | 36 "coreimpl/coreimpl_runtime.dart", |
42 implementation: true, | 37 implementation: true, |
43 dart2jsPath: "compiler/implementation/lib/coreimpl.dart", | 38 dart2jsPath: "compiler/implementation/lib/coreimpl.dart", |
44 dart2jsPatchPath: "compiler/implementation/lib/coreimpl_patch.dart"), | 39 dart2jsPatchPath: "compiler/implementation/lib/coreimpl_patch.dart"), |
45 | 40 |
(...skipping 22 matching lines...) Expand all Loading... |
68 dart2jsPatchPath: "compiler/implementation/lib/isolate_patch.dart"), | 63 dart2jsPatchPath: "compiler/implementation/lib/isolate_patch.dart"), |
69 | 64 |
70 "json": const LibraryInfo( | 65 "json": const LibraryInfo( |
71 "json/json.dart"), | 66 "json/json.dart"), |
72 | 67 |
73 "math": const LibraryInfo( | 68 "math": const LibraryInfo( |
74 "math/math.dart", | 69 "math/math.dart", |
75 dart2jsPatchPath: "compiler/implementation/lib/math_patch.dart"), | 70 dart2jsPatchPath: "compiler/implementation/lib/math_patch.dart"), |
76 | 71 |
77 "mirrors": const LibraryInfo( | 72 "mirrors": const LibraryInfo( |
78 "mirrors/mirrors.dart"), | 73 "mirrors/mirrors.dart", |
| 74 documented: false, |
| 75 platforms: VM_PLATFORM), |
79 | 76 |
80 "nativewrappers": const LibraryInfo( | 77 "nativewrappers": const LibraryInfo( |
81 "html/nativewrappers.dart", | 78 "html/nativewrappers.dart", |
82 category: "Client", | 79 category: "Client", |
83 implementation: true, | 80 implementation: true, |
84 documented: false, | 81 documented: false, |
85 platforms: VM_PLATFORM), | 82 platforms: VM_PLATFORM), |
86 | 83 |
87 "uri": const LibraryInfo( | 84 "uri": const LibraryInfo( |
88 "uri/uri.dart"), | 85 "uri/uri.dart"), |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 final bool implementation; | 154 final bool implementation; |
158 | 155 |
159 const LibraryInfo(this.path, [ | 156 const LibraryInfo(this.path, [ |
160 this.category = "Shared", | 157 this.category = "Shared", |
161 this.dart2jsPath, | 158 this.dart2jsPath, |
162 this.dart2jsPatchPath, | 159 this.dart2jsPatchPath, |
163 this.implementation = false, | 160 this.implementation = false, |
164 this.documented = true, | 161 this.documented = true, |
165 this.platforms = DART2JS_PLATFORM | VM_PLATFORM]); | 162 this.platforms = DART2JS_PLATFORM | VM_PLATFORM]); |
166 | 163 |
167 bool isDart2JsLibrary() => (platforms & DART2JS_PLATFORM) != 0; | 164 bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0; |
168 bool isVmLibrary() => (platforms & VM_PLATFORM) != 0; | 165 bool get isVmLibrary => (platforms & VM_PLATFORM) != 0; |
169 | |
170 String getDart2JsPath() => | |
171 dart2jsPath != null ? "lib/$dart2jsPath" : "lib/$path"; | |
172 | |
173 String getDart2jsPatchPath() => | |
174 dart2jsPatchPath != null ? "lib/$dart2jsPatchPath" : null; | |
175 } | 166 } |
OLD | NEW |