| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.sdk; | 8 library engine.sdk; |
| 9 | 9 |
| 10 import 'source.dart' show ContentCache, Source, UriKind; | 10 import 'source.dart' show ContentCache, Source, UriKind; |
| 11 import 'ast.dart'; | 11 import 'ast.dart'; |
| 12 import 'engine.dart' show AnalysisContext; | 12 import 'engine.dart' show AnalysisContext; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Represents a single library in the SDK | 15 * Instances of the class `DartSdk` represent a Dart SDK installed in a specifie
d location. |
| 16 */ | 16 */ |
| 17 abstract class SdkLibrary { | 17 abstract class DartSdk { |
| 18 /** | 18 /** |
| 19 * Return the name of the category containing the library. | 19 * The short name of the dart SDK async library. |
| 20 * | |
| 21 * @return the name of the category containing the library | |
| 22 */ | 20 */ |
| 23 String get category; | 21 static final String DART_ASYNC = "dart:async"; |
| 24 | 22 |
| 25 /** | 23 /** |
| 26 * Return the path to the file defining the library. The path is relative to t
he `lib` | 24 * The short name of the dart SDK core library. |
| 27 * directory within the SDK. | |
| 28 * | |
| 29 * @return the path to the file defining the library | |
| 30 */ | 25 */ |
| 31 String get path; | 26 static final String DART_CORE = "dart:core"; |
| 32 | 27 |
| 33 /** | 28 /** |
| 34 * Return the short name of the library. This is the name used after `dart:` i
n a URI. | 29 * The short name of the dart SDK html library. |
| 35 * | |
| 36 * @return the short name of the library | |
| 37 */ | 30 */ |
| 38 String get shortName; | 31 static final String DART_HTML = "dart:html"; |
| 39 | 32 |
| 40 /** | 33 /** |
| 41 * Return `true` if this library can be compiled to JavaScript by dart2js. | 34 * The version number that is returned when the real version number could not
be determined. |
| 42 * | |
| 43 * @return `true` if this library can be compiled to JavaScript by dart2js | |
| 44 */ | 35 */ |
| 45 bool get isDart2JsLibrary; | 36 static final String DEFAULT_VERSION = "0"; |
| 46 | 37 |
| 47 /** | 38 /** |
| 48 * Return `true` if the library is documented. | 39 * Return the source representing the file with the given URI. |
| 49 * | 40 * |
| 50 * @return `true` if the library is documented | 41 * @param kind the kind of URI that was originally resolved in order to produc
e an encoding with |
| 42 * the given URI |
| 43 * @param uri the URI of the file to be returned |
| 44 * @return the source representing the specified file |
| 51 */ | 45 */ |
| 52 bool get isDocumented; | 46 Source fromEncoding(UriKind kind, Uri uri); |
| 53 | 47 |
| 54 /** | 48 /** |
| 55 * Return `true` if the library is an implementation library. | 49 * Return the [AnalysisContext] used for all of the sources in this [DartSdk]. |
| 56 * | 50 * |
| 57 * @return `true` if the library is an implementation library | 51 * @return the [AnalysisContext] used for all of the sources in this [DartSdk] |
| 58 */ | 52 */ |
| 59 bool get isImplementation; | 53 AnalysisContext get context; |
| 60 | 54 |
| 61 /** | 55 /** |
| 62 * Return `true` if library is internal can be used only by other SDK librarie
s. | 56 * Return an array containing all of the libraries defined in this SDK. |
| 63 * | 57 * |
| 64 * @return `true` if library is internal can be used only by other SDK librari
es | 58 * @return the libraries defined in this SDK |
| 65 */ | 59 */ |
| 66 bool get isInternal; | 60 List<SdkLibrary> get sdkLibraries; |
| 67 | 61 |
| 68 /** | 62 /** |
| 69 * Return `true` if library can be used for both client and server. | 63 * Return the library representing the library with the given `dart:` URI, or
`null` |
| 64 * if the given URI does not denote a library in this SDK. |
| 70 * | 65 * |
| 71 * @return `true` if this library can be used for both client and server. | 66 * @param dartUri the URI of the library to be returned |
| 67 * @return the SDK library object |
| 72 */ | 68 */ |
| 73 bool get isShared; | 69 SdkLibrary getSdkLibrary(String dartUri); |
| 74 | 70 |
| 75 /** | 71 /** |
| 76 * Return `true` if this library can be run on the VM. | 72 * Return the revision number of this SDK, or `"0"` if the revision number can
not be |
| 73 * discovered. |
| 77 * | 74 * |
| 78 * @return `true` if this library can be run on the VM | 75 * @return the revision number of this SDK |
| 79 */ | 76 */ |
| 80 bool get isVmLibrary; | 77 String get sdkVersion; |
| 78 |
| 79 /** |
| 80 * Return an array containing the library URI's for the libraries defined in t
his SDK. |
| 81 * |
| 82 * @return the library URI's for the libraries defined in this SDK |
| 83 */ |
| 84 List<String> get uris; |
| 85 |
| 86 /** |
| 87 * Return the source representing the library with the given `dart:` URI, or `
null` if |
| 88 * the given URI does not denote a library in this SDK. |
| 89 * |
| 90 * @param dartUri the URI of the library to be returned |
| 91 * @return the source representing the specified library |
| 92 */ |
| 93 Source mapDartUri(String dartUri); |
| 94 } |
| 95 |
| 96 /** |
| 97 * Instances of the class `LibraryMap` map Dart library URI's to the [SdkLibrary
Impl |
| 98 ]. |
| 99 */ |
| 100 class LibraryMap { |
| 101 /** |
| 102 * A table mapping Dart library URI's to the library. |
| 103 */ |
| 104 Map<String, SdkLibraryImpl> _libraryMap = new Map<String, SdkLibraryImpl>(); |
| 105 |
| 106 /** |
| 107 * Return the library with the given URI, or `null` if the URI does not map to
a library. |
| 108 * |
| 109 * @param dartUri the URI of the library to be returned |
| 110 * @return the library with the given URI |
| 111 */ |
| 112 SdkLibrary getLibrary(String dartUri) => _libraryMap[dartUri]; |
| 113 |
| 114 /** |
| 115 * Return an array containing all the sdk libraries [SdkLibraryImpl] in the ma
pping |
| 116 * |
| 117 * @return the sdk libraries in the mapping |
| 118 */ |
| 119 List<SdkLibrary> get sdkLibraries => new List.from(_libraryMap.values); |
| 120 |
| 121 /** |
| 122 * Return an array containing the library URI's for which a mapping is availab
le. |
| 123 * |
| 124 * @return the library URI's for which a mapping is available |
| 125 */ |
| 126 List<String> get uris => new List.from(_libraryMap.keys.toSet()); |
| 127 |
| 128 /** |
| 129 * Return the library with the given URI, or `null` if the URI does not map to
a library. |
| 130 * |
| 131 * @param dartUri the URI of the library to be returned |
| 132 * @param library the library with the given URI |
| 133 */ |
| 134 void setLibrary(String dartUri, SdkLibraryImpl library) { |
| 135 _libraryMap[dartUri] = library; |
| 136 } |
| 137 |
| 138 /** |
| 139 * Return the number of library URI's for which a mapping is available. |
| 140 * |
| 141 * @return the number of library URI's for which a mapping is available |
| 142 */ |
| 143 int size() => _libraryMap.length; |
| 81 } | 144 } |
| 82 | 145 |
| 83 class SdkLibrariesReader_LibraryBuilder extends RecursiveAstVisitor<Object> { | 146 class SdkLibrariesReader_LibraryBuilder extends RecursiveAstVisitor<Object> { |
| 84 /** | 147 /** |
| 85 * The prefix added to the name of a library to form the URI used in code to r
eference the | 148 * The prefix added to the name of a library to form the URI used in code to r
eference the |
| 86 * library. | 149 * library. |
| 87 */ | 150 */ |
| 88 static String _LIBRARY_PREFIX = "dart:"; | 151 static String _LIBRARY_PREFIX = "dart:"; |
| 89 | 152 |
| 90 /** | 153 /** |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 249 } |
| 187 } | 250 } |
| 188 } | 251 } |
| 189 _librariesMap.setLibrary(libraryName, library); | 252 _librariesMap.setLibrary(libraryName, library); |
| 190 } | 253 } |
| 191 return null; | 254 return null; |
| 192 } | 255 } |
| 193 } | 256 } |
| 194 | 257 |
| 195 /** | 258 /** |
| 196 * Instances of the class `LibraryMap` map Dart library URI's to the [SdkLibrary
Impl | 259 * Represents a single library in the SDK |
| 197 ]. | |
| 198 */ | 260 */ |
| 199 class LibraryMap { | 261 abstract class SdkLibrary { |
| 200 /** | 262 /** |
| 201 * A table mapping Dart library URI's to the library. | 263 * Return the name of the category containing the library. |
| 264 * |
| 265 * @return the name of the category containing the library |
| 202 */ | 266 */ |
| 203 Map<String, SdkLibraryImpl> _libraryMap = new Map<String, SdkLibraryImpl>(); | 267 String get category; |
| 204 | 268 |
| 205 /** | 269 /** |
| 206 * Return the library with the given URI, or `null` if the URI does not map to
a library. | 270 * Return the path to the file defining the library. The path is relative to t
he `lib` |
| 271 * directory within the SDK. |
| 207 * | 272 * |
| 208 * @param dartUri the URI of the library to be returned | 273 * @return the path to the file defining the library |
| 209 * @return the library with the given URI | |
| 210 */ | 274 */ |
| 211 SdkLibrary getLibrary(String dartUri) => _libraryMap[dartUri]; | 275 String get path; |
| 212 | 276 |
| 213 /** | 277 /** |
| 214 * Return an array containing all the sdk libraries [SdkLibraryImpl] in the ma
pping | 278 * Return the short name of the library. This is the name used after `dart:` i
n a URI. |
| 215 * | 279 * |
| 216 * @return the sdk libraries in the mapping | 280 * @return the short name of the library |
| 217 */ | 281 */ |
| 218 List<SdkLibrary> get sdkLibraries => new List.from(_libraryMap.values); | 282 String get shortName; |
| 219 | 283 |
| 220 /** | 284 /** |
| 221 * Return an array containing the library URI's for which a mapping is availab
le. | 285 * Return `true` if this library can be compiled to JavaScript by dart2js. |
| 222 * | 286 * |
| 223 * @return the library URI's for which a mapping is available | 287 * @return `true` if this library can be compiled to JavaScript by dart2js |
| 224 */ | 288 */ |
| 225 List<String> get uris => new List.from(_libraryMap.keys.toSet()); | 289 bool get isDart2JsLibrary; |
| 226 | 290 |
| 227 /** | 291 /** |
| 228 * Return the library with the given URI, or `null` if the URI does not map to
a library. | 292 * Return `true` if the library is documented. |
| 229 * | 293 * |
| 230 * @param dartUri the URI of the library to be returned | 294 * @return `true` if the library is documented |
| 231 * @param library the library with the given URI | |
| 232 */ | 295 */ |
| 233 void setLibrary(String dartUri, SdkLibraryImpl library) { | 296 bool get isDocumented; |
| 234 _libraryMap[dartUri] = library; | |
| 235 } | |
| 236 | 297 |
| 237 /** | 298 /** |
| 238 * Return the number of library URI's for which a mapping is available. | 299 * Return `true` if the library is an implementation library. |
| 239 * | 300 * |
| 240 * @return the number of library URI's for which a mapping is available | 301 * @return `true` if the library is an implementation library |
| 241 */ | 302 */ |
| 242 int size() => _libraryMap.length; | 303 bool get isImplementation; |
| 304 |
| 305 /** |
| 306 * Return `true` if library is internal can be used only by other SDK librarie
s. |
| 307 * |
| 308 * @return `true` if library is internal can be used only by other SDK librari
es |
| 309 */ |
| 310 bool get isInternal; |
| 311 |
| 312 /** |
| 313 * Return `true` if library can be used for both client and server. |
| 314 * |
| 315 * @return `true` if this library can be used for both client and server. |
| 316 */ |
| 317 bool get isShared; |
| 318 |
| 319 /** |
| 320 * Return `true` if this library can be run on the VM. |
| 321 * |
| 322 * @return `true` if this library can be run on the VM |
| 323 */ |
| 324 bool get isVmLibrary; |
| 243 } | 325 } |
| 244 | 326 |
| 245 /** | 327 /** |
| 246 * Instances of the class `SdkLibrary` represent the information known about a s
ingle library | 328 * Instances of the class `SdkLibrary` represent the information known about a s
ingle library |
| 247 * within the SDK. | 329 * within the SDK. |
| 248 */ | 330 */ |
| 249 class SdkLibraryImpl implements SdkLibrary { | 331 class SdkLibraryImpl implements SdkLibrary { |
| 250 /** | 332 /** |
| 251 * The short name of the library. This is the name used after `dart:` in a URI
. | 333 * The short name of the library. This is the name used after `dart:` in a URI
. |
| 252 */ | 334 */ |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 void set implementation(bool implementation) { | 435 void set implementation(bool implementation) { |
| 354 this._implementation = implementation; | 436 this._implementation = implementation; |
| 355 } | 437 } |
| 356 | 438 |
| 357 /** | 439 /** |
| 358 * Record that this library can be run on the VM. | 440 * Record that this library can be run on the VM. |
| 359 */ | 441 */ |
| 360 void setVmLibrary() { | 442 void setVmLibrary() { |
| 361 _platforms |= VM_PLATFORM; | 443 _platforms |= VM_PLATFORM; |
| 362 } | 444 } |
| 363 } | |
| 364 | |
| 365 /** | |
| 366 * Instances of the class `DartSdk` represent a Dart SDK installed in a specifie
d location. | |
| 367 */ | |
| 368 abstract class DartSdk { | |
| 369 /** | |
| 370 * The short name of the dart SDK async library. | |
| 371 */ | |
| 372 static final String DART_ASYNC = "dart:async"; | |
| 373 | |
| 374 /** | |
| 375 * The short name of the dart SDK core library. | |
| 376 */ | |
| 377 static final String DART_CORE = "dart:core"; | |
| 378 | |
| 379 /** | |
| 380 * The short name of the dart SDK html library. | |
| 381 */ | |
| 382 static final String DART_HTML = "dart:html"; | |
| 383 | |
| 384 /** | |
| 385 * The version number that is returned when the real version number could not
be determined. | |
| 386 */ | |
| 387 static final String DEFAULT_VERSION = "0"; | |
| 388 | |
| 389 /** | |
| 390 * Return the source representing the file with the given URI. | |
| 391 * | |
| 392 * @param kind the kind of URI that was originally resolved in order to produc
e an encoding with | |
| 393 * the given URI | |
| 394 * @param uri the URI of the file to be returned | |
| 395 * @return the source representing the specified file | |
| 396 */ | |
| 397 Source fromEncoding(UriKind kind, Uri uri); | |
| 398 | |
| 399 /** | |
| 400 * Return the [AnalysisContext] used for all of the sources in this [DartSdk]. | |
| 401 * | |
| 402 * @return the [AnalysisContext] used for all of the sources in this [DartSdk] | |
| 403 */ | |
| 404 AnalysisContext get context; | |
| 405 | |
| 406 /** | |
| 407 * Return an array containing all of the libraries defined in this SDK. | |
| 408 * | |
| 409 * @return the libraries defined in this SDK | |
| 410 */ | |
| 411 List<SdkLibrary> get sdkLibraries; | |
| 412 | |
| 413 /** | |
| 414 * Return the library representing the library with the given `dart:` URI, or
`null` | |
| 415 * if the given URI does not denote a library in this SDK. | |
| 416 * | |
| 417 * @param dartUri the URI of the library to be returned | |
| 418 * @return the SDK library object | |
| 419 */ | |
| 420 SdkLibrary getSdkLibrary(String dartUri); | |
| 421 | |
| 422 /** | |
| 423 * Return the revision number of this SDK, or `"0"` if the revision number can
not be | |
| 424 * discovered. | |
| 425 * | |
| 426 * @return the revision number of this SDK | |
| 427 */ | |
| 428 String get sdkVersion; | |
| 429 | |
| 430 /** | |
| 431 * Return an array containing the library URI's for the libraries defined in t
his SDK. | |
| 432 * | |
| 433 * @return the library URI's for the libraries defined in this SDK | |
| 434 */ | |
| 435 List<String> get uris; | |
| 436 | |
| 437 /** | |
| 438 * Return the source representing the library with the given `dart:` URI, or `
null` if | |
| 439 * the given URI does not denote a library in this SDK. | |
| 440 * | |
| 441 * @param dartUri the URI of the library to be returned | |
| 442 * @return the source representing the specified library | |
| 443 */ | |
| 444 Source mapDartUri(String dartUri); | |
| 445 } | 445 } |
| OLD | NEW |