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; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 */ | 202 */ |
203 static String _LIBRARY_PREFIX = "dart:"; | 203 static String _LIBRARY_PREFIX = "dart:"; |
204 | 204 |
205 /** | 205 /** |
206 * The name of the optional parameter used to indicate whether the library is
an implementation | 206 * The name of the optional parameter used to indicate whether the library is
an implementation |
207 * library. | 207 * library. |
208 */ | 208 */ |
209 static String _IMPLEMENTATION = "implementation"; | 209 static String _IMPLEMENTATION = "implementation"; |
210 | 210 |
211 /** | 211 /** |
| 212 * The name of the optional parameter used to specify the path used when compi
ling for dart2js. |
| 213 */ |
| 214 static String _DART2JS_PATH = "dart2jsPath"; |
| 215 |
| 216 /** |
212 * The name of the optional parameter used to indicate whether the library is
documented. | 217 * The name of the optional parameter used to indicate whether the library is
documented. |
213 */ | 218 */ |
214 static String _DOCUMENTED = "documented"; | 219 static String _DOCUMENTED = "documented"; |
215 | 220 |
216 /** | 221 /** |
217 * The name of the optional parameter used to specify the category of the libr
ary. | 222 * The name of the optional parameter used to specify the category of the libr
ary. |
218 */ | 223 */ |
219 static String _CATEGORY = "category"; | 224 static String _CATEGORY = "category"; |
220 | 225 |
221 /** | 226 /** |
222 * The name of the optional parameter used to specify the platforms on which t
he library can be | 227 * The name of the optional parameter used to specify the platforms on which t
he library can be |
223 * used. | 228 * used. |
224 */ | 229 */ |
225 static String _PLATFORMS = "platforms"; | 230 static String _PLATFORMS = "platforms"; |
226 | 231 |
227 /** | 232 /** |
228 * The value of the [PLATFORMS] parameter used to specify that the library can | 233 * The value of the [PLATFORMS] parameter used to specify that the library can |
229 * be used on the VM. | 234 * be used on the VM. |
230 */ | 235 */ |
231 static String _VM_PLATFORM = "VM_PLATFORM"; | 236 static String _VM_PLATFORM = "VM_PLATFORM"; |
232 | 237 |
233 /** | 238 /** |
| 239 * A flag indicating whether the dart2js path should be used when it is availa
ble. |
| 240 */ |
| 241 bool _useDart2jsPaths = false; |
| 242 |
| 243 /** |
234 * The library map that is populated by visiting the AST structure parsed from
the contents of | 244 * The library map that is populated by visiting the AST structure parsed from
the contents of |
235 * the libraries file. | 245 * the libraries file. |
236 */ | 246 */ |
237 final LibraryMap librariesMap = new LibraryMap(); | 247 LibraryMap _librariesMap = new LibraryMap(); |
| 248 |
| 249 /** |
| 250 * Initialize a newly created library builder to use the dart2js path if the g
iven value is |
| 251 * `true`. |
| 252 * |
| 253 * @param useDart2jsPaths `true` if the dart2js path should be used when it is
available |
| 254 */ |
| 255 SdkLibrariesReader_LibraryBuilder(bool useDart2jsPaths) { |
| 256 this._useDart2jsPaths = useDart2jsPaths; |
| 257 } |
| 258 |
| 259 /** |
| 260 * Return the library map that was populated by visiting the AST structure par
sed from the |
| 261 * contents of the libraries file. |
| 262 * |
| 263 * @return the library map describing the contents of the SDK |
| 264 */ |
| 265 LibraryMap get librariesMap => _librariesMap; |
238 | 266 |
239 Object visitMapLiteralEntry(MapLiteralEntry node) { | 267 Object visitMapLiteralEntry(MapLiteralEntry node) { |
240 String libraryName = null; | 268 String libraryName = null; |
241 Expression key = node.key; | 269 Expression key = node.key; |
242 if (key is SimpleStringLiteral) { | 270 if (key is SimpleStringLiteral) { |
243 libraryName = "${_LIBRARY_PREFIX}${key.value}"; | 271 libraryName = "${_LIBRARY_PREFIX}${key.value}"; |
244 } | 272 } |
245 Expression value = node.value; | 273 Expression value = node.value; |
246 if (value is InstanceCreationExpression) { | 274 if (value is InstanceCreationExpression) { |
247 SdkLibraryImpl library = new SdkLibraryImpl(libraryName); | 275 SdkLibraryImpl library = new SdkLibraryImpl(libraryName); |
(...skipping 12 matching lines...) Expand all Loading... |
260 library.documented = (expression as BooleanLiteral).value; | 288 library.documented = (expression as BooleanLiteral).value; |
261 } else if (name == _PLATFORMS) { | 289 } else if (name == _PLATFORMS) { |
262 if (expression is SimpleIdentifier) { | 290 if (expression is SimpleIdentifier) { |
263 String identifier = expression.name; | 291 String identifier = expression.name; |
264 if (identifier == _VM_PLATFORM) { | 292 if (identifier == _VM_PLATFORM) { |
265 library.setVmLibrary(); | 293 library.setVmLibrary(); |
266 } else { | 294 } else { |
267 library.setDart2JsLibrary(); | 295 library.setDart2JsLibrary(); |
268 } | 296 } |
269 } | 297 } |
| 298 } else if (_useDart2jsPaths && name == _DART2JS_PATH) { |
| 299 if (expression is SimpleStringLiteral) { |
| 300 library.path = expression.value; |
| 301 } |
270 } | 302 } |
271 } | 303 } |
272 } | 304 } |
273 librariesMap.setLibrary(libraryName, library); | 305 _librariesMap.setLibrary(libraryName, library); |
274 } | 306 } |
275 return null; | 307 return null; |
276 } | 308 } |
277 } | 309 } |
278 | 310 |
279 /** | 311 /** |
280 * Instances of the class `LibraryMap` map Dart library URI's to the [SdkLibrary
Impl | 312 * Instances of the class `LibraryMap` map Dart library URI's to the [SdkLibrary
Impl |
281 ]. | 313 ]. |
282 * | 314 * |
283 * @coverage dart.engine.sdk | 315 * @coverage dart.engine.sdk |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 static final String DART_HTML = "dart:html"; | 377 static final String DART_HTML = "dart:html"; |
346 | 378 |
347 /** | 379 /** |
348 * The version number that is returned when the real version number could not
be determined. | 380 * The version number that is returned when the real version number could not
be determined. |
349 */ | 381 */ |
350 static final String DEFAULT_VERSION = "0"; | 382 static final String DEFAULT_VERSION = "0"; |
351 | 383 |
352 /** | 384 /** |
353 * Return the source representing the file with the given URI. | 385 * Return the source representing the file with the given URI. |
354 * | 386 * |
355 * @param contentCache the content cache used to access the contents of the ma
pped source | |
356 * @param kind the kind of URI that was originally resolved in order to produc
e an encoding with | 387 * @param kind the kind of URI that was originally resolved in order to produc
e an encoding with |
357 * the given URI | 388 * the given URI |
358 * @param uri the URI of the file to be returned | 389 * @param uri the URI of the file to be returned |
359 * @return the source representing the specified file | 390 * @return the source representing the specified file |
360 */ | 391 */ |
361 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri); | 392 Source fromEncoding(UriKind kind, Uri uri); |
362 | 393 |
363 /** | 394 /** |
364 * Return the [AnalysisContext] used for all of the sources in this [DartSdk]. | 395 * Return the [AnalysisContext] used for all of the sources in this [DartSdk]. |
365 * | 396 * |
366 * @return the [AnalysisContext] used for all of the sources in this [DartSdk] | 397 * @return the [AnalysisContext] used for all of the sources in this [DartSdk] |
367 */ | 398 */ |
368 AnalysisContext get context; | 399 AnalysisContext get context; |
369 | 400 |
370 /** | 401 /** |
371 * Return an array containing all of the libraries defined in this SDK. | 402 * Return an array containing all of the libraries defined in this SDK. |
(...skipping 28 matching lines...) Expand all Loading... |
400 | 431 |
401 /** | 432 /** |
402 * Return the source representing the library with the given `dart:` URI, or `
null` if | 433 * Return the source representing the library with the given `dart:` URI, or `
null` if |
403 * the given URI does not denote a library in this SDK. | 434 * the given URI does not denote a library in this SDK. |
404 * | 435 * |
405 * @param dartUri the URI of the library to be returned | 436 * @param dartUri the URI of the library to be returned |
406 * @return the source representing the specified library | 437 * @return the source representing the specified library |
407 */ | 438 */ |
408 Source mapDartUri(String dartUri); | 439 Source mapDartUri(String dartUri); |
409 } | 440 } |
OLD | NEW |