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.io; | 8 library engine.sdk.io; |
9 | 9 |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 return _analysisContext; | 260 return _analysisContext; |
261 } | 261 } |
262 | 262 |
263 /** | 263 /** |
264 * Return the file containing the dart2js executable, or `null` if it does not
exist. | 264 * Return the file containing the dart2js executable, or `null` if it does not
exist. |
265 * | 265 * |
266 * @return the file containing the dart2js executable | 266 * @return the file containing the dart2js executable |
267 */ | 267 */ |
268 JavaFile get dart2JsExecutable { | 268 JavaFile get dart2JsExecutable { |
269 if (_dart2jsExecutable == null) { | 269 if (_dart2jsExecutable == null) { |
270 _dart2jsExecutable = _verifyExecutable( | 270 _dart2jsExecutable = _verifyExecutable(new JavaFile.relative( |
271 new JavaFile.relative( | 271 new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), |
272 new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), | 272 OSUtilities.isWindows() |
273 OSUtilities.isWindows() ? | 273 ? _DART2JS_EXECUTABLE_NAME_WIN |
274 _DART2JS_EXECUTABLE_NAME_WIN : | 274 : _DART2JS_EXECUTABLE_NAME)); |
275 _DART2JS_EXECUTABLE_NAME)); | |
276 } | 275 } |
277 return _dart2jsExecutable; | 276 return _dart2jsExecutable; |
278 } | 277 } |
279 | 278 |
280 /** | 279 /** |
281 * Return the file containing the dart formatter executable, or `null` if it d
oes not exist. | 280 * Return the file containing the dart formatter executable, or `null` if it d
oes not exist. |
282 * | 281 * |
283 * @return the file containing the dart formatter executable | 282 * @return the file containing the dart formatter executable |
284 */ | 283 */ |
285 JavaFile get dartFmtExecutable { | 284 JavaFile get dartFmtExecutable { |
286 if (_dartFmtExecutable == null) { | 285 if (_dartFmtExecutable == null) { |
287 _dartFmtExecutable = _verifyExecutable( | 286 _dartFmtExecutable = _verifyExecutable(new JavaFile.relative( |
288 new JavaFile.relative( | 287 new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), |
289 new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), | 288 OSUtilities.isWindows() |
290 OSUtilities.isWindows() ? | 289 ? _DARTFMT_EXECUTABLE_NAME_WIN |
291 _DARTFMT_EXECUTABLE_NAME_WIN : | 290 : _DARTFMT_EXECUTABLE_NAME)); |
292 _DARTFMT_EXECUTABLE_NAME)); | |
293 } | 291 } |
294 return _dartFmtExecutable; | 292 return _dartFmtExecutable; |
295 } | 293 } |
296 | 294 |
297 /** | 295 /** |
298 * Return the name of the file containing the Dartium executable. | 296 * Return the name of the file containing the Dartium executable. |
299 * | 297 * |
300 * @return the name of the file containing the Dartium executable | 298 * @return the name of the file containing the Dartium executable |
301 */ | 299 */ |
302 String get dartiumBinaryName { | 300 String get dartiumBinaryName { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 JavaFile get libraryDirectory => | 366 JavaFile get libraryDirectory => |
369 new JavaFile.relative(_sdkDirectory, _LIB_DIRECTORY_NAME); | 367 new JavaFile.relative(_sdkDirectory, _LIB_DIRECTORY_NAME); |
370 | 368 |
371 /** | 369 /** |
372 * Return the file containing the Pub executable, or `null` if it does not exi
st. | 370 * Return the file containing the Pub executable, or `null` if it does not exi
st. |
373 * | 371 * |
374 * @return the file containing the Pub executable | 372 * @return the file containing the Pub executable |
375 */ | 373 */ |
376 JavaFile get pubExecutable { | 374 JavaFile get pubExecutable { |
377 if (_pubExecutable == null) { | 375 if (_pubExecutable == null) { |
378 _pubExecutable = _verifyExecutable( | 376 _pubExecutable = _verifyExecutable(new JavaFile.relative( |
379 new JavaFile.relative( | 377 new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), OSUtilities |
380 new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), | 378 .isWindows() ? _PUB_EXECUTABLE_NAME_WIN : _PUB_EXECUTABLE_NAME)); |
381 OSUtilities.isWindows() ? _PUB_EXECUTABLE_NAME_WIN : _PUB_EXECUTAB
LE_NAME)); | |
382 } | 379 } |
383 return _pubExecutable; | 380 return _pubExecutable; |
384 } | 381 } |
385 | 382 |
386 @override | 383 @override |
387 List<SdkLibrary> get sdkLibraries => _libraryMap.sdkLibraries; | 384 List<SdkLibrary> get sdkLibraries => _libraryMap.sdkLibraries; |
388 | 385 |
389 /** | 386 /** |
390 * Return the revision number of this SDK, or `"0"` if the revision number can
not be | 387 * Return the revision number of this SDK, or `"0"` if the revision number can
not be |
391 * discovered. | 388 * discovered. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 428 } |
432 } | 429 } |
433 | 430 |
434 /** | 431 /** |
435 * Return the file containing the VM executable, or `null` if it does not exis
t. | 432 * Return the file containing the VM executable, or `null` if it does not exis
t. |
436 * | 433 * |
437 * @return the file containing the VM executable | 434 * @return the file containing the VM executable |
438 */ | 435 */ |
439 JavaFile get vmExecutable { | 436 JavaFile get vmExecutable { |
440 if (_vmExecutable == null) { | 437 if (_vmExecutable == null) { |
441 _vmExecutable = _verifyExecutable( | 438 _vmExecutable = _verifyExecutable(new JavaFile.relative( |
442 new JavaFile.relative( | 439 new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), |
443 new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), | 440 vmBinaryName)); |
444 vmBinaryName)); | |
445 } | 441 } |
446 return _vmExecutable; | 442 return _vmExecutable; |
447 } | 443 } |
448 | 444 |
449 @override | 445 @override |
450 Source fromFileUri(Uri uri) { | 446 Source fromFileUri(Uri uri) { |
451 JavaFile file = new JavaFile.fromUri(uri); | 447 JavaFile file = new JavaFile.fromUri(uri); |
452 String filePath = file.getAbsolutePath(); | 448 String filePath = file.getAbsolutePath(); |
453 String libPath = libraryDirectory.getAbsolutePath(); | 449 String libPath = libraryDirectory.getAbsolutePath(); |
454 if (!filePath.startsWith("$libPath${JavaFile.separator}")) { | 450 if (!filePath.startsWith("$libPath${JavaFile.separator}")) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 * | 521 * |
526 * @param useDart2jsPaths `true` if the dart2js path should be used when it is
available | 522 * @param useDart2jsPaths `true` if the dart2js path should be used when it is
available |
527 * @return the initialized library map | 523 * @return the initialized library map |
528 */ | 524 */ |
529 LibraryMap initialLibraryMap(bool useDart2jsPaths) { | 525 LibraryMap initialLibraryMap(bool useDart2jsPaths) { |
530 JavaFile librariesFile = new JavaFile.relative( | 526 JavaFile librariesFile = new JavaFile.relative( |
531 new JavaFile.relative(libraryDirectory, _INTERNAL_DIR), | 527 new JavaFile.relative(libraryDirectory, _INTERNAL_DIR), |
532 _LIBRARIES_FILE); | 528 _LIBRARIES_FILE); |
533 try { | 529 try { |
534 String contents = librariesFile.readAsStringSync(); | 530 String contents = librariesFile.readAsStringSync(); |
535 return new SdkLibrariesReader( | 531 return new SdkLibrariesReader(useDart2jsPaths).readFromFile( |
536 useDart2jsPaths).readFromFile(librariesFile, contents); | 532 librariesFile, contents); |
537 } catch (exception, stackTrace) { | 533 } catch (exception, stackTrace) { |
538 AnalysisEngine.instance.logger.logError( | 534 AnalysisEngine.instance.logger.logError( |
539 "Could not initialize the library map from ${librariesFile.getAbsolute
Path()}", | 535 "Could not initialize the library map from ${librariesFile.getAbsolute
Path()}", |
540 new CaughtException(exception, stackTrace)); | 536 new CaughtException(exception, stackTrace)); |
541 return new LibraryMap(); | 537 return new LibraryMap(); |
542 } | 538 } |
543 } | 539 } |
544 | 540 |
545 @override | 541 @override |
546 Source mapDartUri(String dartUri) { | 542 Source mapDartUri(String dartUri) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 /** | 626 /** |
631 * Return the library map read from the given source. | 627 * Return the library map read from the given source. |
632 * | 628 * |
633 * @param source the source of the library file | 629 * @param source the source of the library file |
634 * @param libraryFileContents the contents from the library file | 630 * @param libraryFileContents the contents from the library file |
635 * @return the library map read from the given source | 631 * @return the library map read from the given source |
636 */ | 632 */ |
637 LibraryMap readFromSource(Source source, String libraryFileContents) { | 633 LibraryMap readFromSource(Source source, String libraryFileContents) { |
638 BooleanErrorListener errorListener = new BooleanErrorListener(); | 634 BooleanErrorListener errorListener = new BooleanErrorListener(); |
639 Scanner scanner = new Scanner( | 635 Scanner scanner = new Scanner( |
640 source, | 636 source, new CharSequenceReader(libraryFileContents), errorListener); |
641 new CharSequenceReader(libraryFileContents), | |
642 errorListener); | |
643 Parser parser = new Parser(source, errorListener); | 637 Parser parser = new Parser(source, errorListener); |
644 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); | 638 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); |
645 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 639 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
646 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 640 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
647 // If any syntactic errors were found then don't try to visit the AST | 641 // If any syntactic errors were found then don't try to visit the AST |
648 // structure. | 642 // structure. |
649 if (!errorListener.errorReported) { | 643 if (!errorListener.errorReported) { |
650 unit.accept(libraryBuilder); | 644 unit.accept(libraryBuilder); |
651 } | 645 } |
652 return libraryBuilder.librariesMap; | 646 return libraryBuilder.librariesMap; |
653 } | 647 } |
654 } | 648 } |
OLD | NEW |