| 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 // Used by VM applications | |
| 26 "builtin": const LibraryInfo( | 25 "builtin": const LibraryInfo( |
| 27 "builtin/builtin_runtime.dart", | 26 "builtin/builtin_runtime.dart", |
| 28 category: "Server", | 27 category: "Server", |
| 29 platforms: VM_PLATFORM), | 28 platforms: VM_PLATFORM), |
| 30 | 29 |
| 31 // Is moving to pkg directory | 30 // Is moving to pkg directory |
| 32 "compiler": const LibraryInfo( | 31 "compiler": const LibraryInfo( |
| 33 "compiler/compiler.dart", | 32 "compiler/compiler.dart", |
| 34 category: "Tools", | 33 category: "Tools", |
| 35 platforms: 0), | 34 platforms: 0), |
| 36 | 35 |
| 37 "core": const LibraryInfo( | 36 "core": const LibraryInfo( |
| 38 "core/core_runtime.dart", | 37 "core/core_runtime.dart", |
| 39 dart2jsPath: "compiler/implementation/lib/core.dart"), | 38 dart2jsPath: "compiler/implementation/lib/core.dart"), |
| 40 | 39 |
| 41 "coreimpl": const LibraryInfo( | 40 "coreimpl": const LibraryInfo( |
| 42 "coreimpl/coreimpl_runtime.dart", | 41 "coreimpl/coreimpl_runtime.dart", |
| 43 implementation: true, | 42 implementation: true, |
| 44 dart2jsPath: "compiler/implementation/lib/coreimpl.dart", | 43 dart2jsPath: "compiler/implementation/lib/coreimpl.dart", |
| 45 dart2jsPatchPath: "compiler/implementation/lib/coreimpl.dartp"), | 44 dart2jsPatchPath: "compiler/implementation/lib/coreimpl_patch.dart"), |
| 46 | 45 |
| 47 "crypto": const LibraryInfo( | 46 "crypto": const LibraryInfo( |
| 48 "crypto/crypto.dart"), | 47 "crypto/crypto.dart"), |
| 49 | 48 |
| 50 // dom/dom_frog.dart is a placeholder for dartium dom | 49 // dom/dom_frog.dart is a placeholder for dartium DOM. |
| 51 "dom_deprecated": const LibraryInfo( | 50 "dom_deprecated": const LibraryInfo( |
| 52 "dom/dom_dart2js.dart", | 51 "dom/dom_dart2js.dart", |
| 53 implementation: true, | 52 implementation: true, |
| 54 dart2jsPath: "dom/dart2js/dom_dart2js.dart", | 53 dart2jsPath: "dom/dart2js/dom_dart2js.dart", |
| 55 documented: false), | 54 documented: false), |
| 56 | 55 |
| 57 "html": const LibraryInfo( | 56 "html": const LibraryInfo( |
| 58 "html/html_dartium.dart", | 57 "html/html_dartium.dart", |
| 59 category: "Client", | 58 category: "Client", |
| 60 dart2jsPath: "html/dart2js/html_dart2js.dart"), | 59 dart2jsPath: "html/dart2js/html_dart2js.dart"), |
| 61 | 60 |
| 62 "io": const LibraryInfo( | 61 "io": const LibraryInfo( |
| 63 "io/io_runtime.dart", | 62 "io/io_runtime.dart", |
| 64 category: "Server", | 63 category: "Server", |
| 65 dart2jsPath: "compiler/implementation/lib/io.dart"), | 64 dart2jsPath: "compiler/implementation/lib/io.dart"), |
| 66 | 65 |
| 67 "isolate": const LibraryInfo( | 66 "isolate": const LibraryInfo( |
| 68 "isolate/isolate.dart"), | 67 "isolate/isolate.dart", |
| 68 dart2jsPatchPath: "compiler/implementation/lib/isolate_patch.dart"), |
| 69 | 69 |
| 70 "json": const LibraryInfo( | 70 "json": const LibraryInfo( |
| 71 "json/json.dart"), | 71 "json/json.dart"), |
| 72 | 72 |
| 73 "math": const LibraryInfo( | 73 "math": const LibraryInfo( |
| 74 "math/math.dart", | 74 "math/math.dart", |
| 75 dart2jsPatchPath: "compiler/implementation/lib/math.dartp"), | 75 dart2jsPatchPath: "compiler/implementation/lib/math_patch.dart"), |
| 76 | 76 |
| 77 "mirrors": const LibraryInfo( | 77 "mirrors": const LibraryInfo( |
| 78 "mirrors/mirrors.dart"), | 78 "mirrors/mirrors.dart"), |
| 79 | 79 |
| 80 // Used by Dartium applications | |
| 81 "nativewrappers": const LibraryInfo( | 80 "nativewrappers": const LibraryInfo( |
| 82 "html/nativewrappers.dart", | 81 "html/nativewrappers.dart", |
| 83 category: "Client", | 82 category: "Client", |
| 84 implementation: true, | 83 implementation: true, |
| 85 documented: false, | 84 documented: false, |
| 86 platforms: VM_PLATFORM), | 85 platforms: VM_PLATFORM), |
| 87 | 86 |
| 88 "uri": const LibraryInfo( | 87 "uri": const LibraryInfo( |
| 89 "uri/uri.dart"), | 88 "uri/uri.dart"), |
| 90 | 89 |
| 91 "utf": const LibraryInfo( | 90 "utf": const LibraryInfo( |
| 92 "utf/utf.dart"), | 91 "utf/utf.dart"), |
| 93 | 92 |
| 94 "web": const LibraryInfo( | 93 "web": const LibraryInfo( |
| 95 "web/web.dart"), | 94 "web/web.dart"), |
| 96 | 95 |
| 97 // Used by dart2js | |
| 98 "_js_helper": const LibraryInfo( | 96 "_js_helper": const LibraryInfo( |
| 99 "compiler/implementation/lib/js_helper.dart", | 97 "compiler/implementation/lib/js_helper.dart", |
| 100 category: "Internal", | 98 category: "Internal", |
| 101 documented: false, | 99 documented: false, |
| 102 platforms: DART2JS_PLATFORM), | 100 platforms: DART2JS_PLATFORM), |
| 103 | 101 |
| 104 // Used by dart2js | |
| 105 "_interceptors": const LibraryInfo( | 102 "_interceptors": const LibraryInfo( |
| 106 "compiler/implementation/lib/interceptors.dart", | 103 "compiler/implementation/lib/interceptors.dart", |
| 107 category: "Internal", | 104 category: "Internal", |
| 108 documented: false, | 105 documented: false, |
| 109 platforms: DART2JS_PLATFORM), | 106 platforms: DART2JS_PLATFORM), |
| 110 }; | 107 }; |
| 111 | 108 |
| 112 /** | 109 /** |
| 113 * Information about a "dart:" library. | 110 * Information about a "dart:" library. |
| 114 */ | 111 */ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 133 final String dart2jsPath; | 130 final String dart2jsPath; |
| 134 | 131 |
| 135 /** | 132 /** |
| 136 * Path to the dart2js library's patch file relative to this file | 133 * Path to the dart2js library's patch file relative to this file |
| 137 * or null if no dart2js patch file associated with this library. | 134 * or null if no dart2js patch file associated with this library. |
| 138 * Access using the [#getDart2JsPatchPath()] method. | 135 * Access using the [#getDart2JsPatchPath()] method. |
| 139 */ | 136 */ |
| 140 final String dart2jsPatchPath; | 137 final String dart2jsPatchPath; |
| 141 | 138 |
| 142 /** | 139 /** |
| 143 * True if this library is documented and should be shown to the user | 140 * True if this library is documented and should be shown to the user. |
| 144 */ | 141 */ |
| 145 final bool documented; | 142 final bool documented; |
| 146 | 143 |
| 147 /** | 144 /** |
| 148 * Bit flags indicating which platforms consume this library | 145 * Bit flags indicating which platforms consume this library. |
| 149 * See [DART2JS_LIBRARY] and [VM_LIBRARY] | 146 * See [DART2JS_LIBRARY] and [VM_LIBRARY]. |
| 150 */ | 147 */ |
| 151 final int platforms; | 148 final int platforms; |
| 152 | 149 |
| 153 /** | 150 /** |
| 154 * True if the library contains implementation details for another library. | 151 * True if the library contains implementation details for another library. |
| 155 * The implication is that these libraries are less commonly used | 152 * The implication is that these libraries are less commonly used |
| 156 * and that tools like Dart Editor should not show these libraries | 153 * and that tools like Dart Editor should not show these libraries |
| 157 * in a list of all libraries unless the user specifically asks the tool to do
so. | 154 * in a list of all libraries unless the user specifically asks the tool to |
| 158 * (e.g. "coreimpl" contains implementation for the "core" library). | 155 * do so. (E.g. "coreimpl" contains implementation for the "core" library). |
| 159 */ | 156 */ |
| 160 final bool implementation; | 157 final bool implementation; |
| 161 | 158 |
| 162 const LibraryInfo(this.path, [ | 159 const LibraryInfo(this.path, [ |
| 163 this.category = "Shared", | 160 this.category = "Shared", |
| 164 this.dart2jsPath, | 161 this.dart2jsPath, |
| 165 this.dart2jsPatchPath, | 162 this.dart2jsPatchPath, |
| 166 this.implementation = false, | 163 this.implementation = false, |
| 167 this.documented = true, | 164 this.documented = true, |
| 168 this.platforms = DART2JS_PLATFORM | VM_PLATFORM]); | 165 this.platforms = DART2JS_PLATFORM | VM_PLATFORM]); |
| 169 | 166 |
| 170 bool isDart2JsLibrary() => (platforms & DART2JS_PLATFORM) != 0; | 167 bool isDart2JsLibrary() => (platforms & DART2JS_PLATFORM) != 0; |
| 171 bool isVmLibrary() => (platforms & VM_PLATFORM) != 0; | 168 bool isVmLibrary() => (platforms & VM_PLATFORM) != 0; |
| 172 | 169 |
| 173 String getDart2JsPath() => dart2jsPath != null ? "lib/$dart2jsPath" : "lib/$pa
th"; | 170 String getDart2JsPath() => |
| 174 String getDart2jsPatchPath() => dart2jsPatchPath != null ? "lib/$dart2jsPatchP
ath" : null; | 171 dart2jsPath != null ? "lib/$dart2jsPath" : "lib/$path"; |
| 172 |
| 173 String getDart2jsPatchPath() => |
| 174 dart2jsPatchPath != null ? "lib/$dart2jsPatchPath" : null; |
| 175 } | 175 } |
| OLD | NEW |