| 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 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 DirectoryBasedDartSdk(JavaFile sdkDirectory) : this.con1(sdkDirectory, false); | 177 DirectoryBasedDartSdk(JavaFile sdkDirectory) : this.con1(sdkDirectory, false); |
| 178 | 178 |
| 179 /** | 179 /** |
| 180 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. | 180 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. |
| 181 * | 181 * |
| 182 * @param sdkDirectory the directory containing the SDK | 182 * @param sdkDirectory the directory containing the SDK |
| 183 * @param useDart2jsPaths `true` if the dart2js path should be used when it is
available | 183 * @param useDart2jsPaths `true` if the dart2js path should be used when it is
available |
| 184 */ | 184 */ |
| 185 DirectoryBasedDartSdk.con1(JavaFile sdkDirectory, bool useDart2jsPaths) { | 185 DirectoryBasedDartSdk.con1(JavaFile sdkDirectory, bool useDart2jsPaths) { |
| 186 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); | 186 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); |
| 187 initializeSdk(); | 187 _initializeSdk(); |
| 188 initializeLibraryMap(useDart2jsPaths); | 188 _initializeLibraryMap(useDart2jsPaths); |
| 189 _analysisContext = new AnalysisContextImpl(); | 189 _analysisContext = new AnalysisContextImpl(); |
| 190 _analysisContext.sourceFactory = new SourceFactory([new DartUriResolver(this
)]); | 190 _analysisContext.sourceFactory = new SourceFactory([new DartUriResolver(this
)]); |
| 191 List<String> uris = this.uris; | 191 List<String> uris = this.uris; |
| 192 ChangeSet changeSet = new ChangeSet(); | 192 ChangeSet changeSet = new ChangeSet(); |
| 193 for (String uri in uris) { | 193 for (String uri in uris) { |
| 194 changeSet.addedSource(_analysisContext.sourceFactory.forUri(uri)); | 194 changeSet.addedSource(_analysisContext.sourceFactory.forUri(uri)); |
| 195 } | 195 } |
| 196 _analysisContext.applyChanges(changeSet); | 196 _analysisContext.applyChanges(changeSet); |
| 197 } | 197 } |
| 198 | 198 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 if (library == null) { | 342 if (library == null) { |
| 343 return null; | 343 return null; |
| 344 } | 344 } |
| 345 return new FileBasedSource.con2(new JavaFile.relative(libraryDirectory, libr
ary.path), UriKind.DART_URI); | 345 return new FileBasedSource.con2(new JavaFile.relative(libraryDirectory, libr
ary.path), UriKind.DART_URI); |
| 346 } | 346 } |
| 347 | 347 |
| 348 /** | 348 /** |
| 349 * Ensure that the dart VM is executable. If it is not, make it executable and
log that it was | 349 * Ensure that the dart VM is executable. If it is not, make it executable and
log that it was |
| 350 * necessary for us to do so. | 350 * necessary for us to do so. |
| 351 */ | 351 */ |
| 352 void ensureVmIsExecutable() { | 352 void _ensureVmIsExecutable() { |
| 353 } | 353 } |
| 354 | 354 |
| 355 /** | 355 /** |
| 356 * Return the name of the file containing the Dartium executable. | 356 * Return the name of the file containing the Dartium executable. |
| 357 * | 357 * |
| 358 * @return the name of the file containing the Dartium executable | 358 * @return the name of the file containing the Dartium executable |
| 359 */ | 359 */ |
| 360 String get dartiumBinaryName { | 360 String get dartiumBinaryName { |
| 361 if (OSUtilities.isWindows()) { | 361 if (OSUtilities.isWindows()) { |
| 362 return _DARTIUM_EXECUTABLE_NAME_WIN; | 362 return _DARTIUM_EXECUTABLE_NAME_WIN; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 378 } else { | 378 } else { |
| 379 return _VM_EXECUTABLE_NAME; | 379 return _VM_EXECUTABLE_NAME; |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 | 382 |
| 383 /** | 383 /** |
| 384 * Read all of the configuration files to initialize the library maps. | 384 * Read all of the configuration files to initialize the library maps. |
| 385 * | 385 * |
| 386 * @param useDart2jsPaths `true` if the dart2js path should be used when it is
available | 386 * @param useDart2jsPaths `true` if the dart2js path should be used when it is
available |
| 387 */ | 387 */ |
| 388 void initializeLibraryMap(bool useDart2jsPaths) { | 388 void _initializeLibraryMap(bool useDart2jsPaths) { |
| 389 JavaFile librariesFile = new JavaFile.relative(new JavaFile.relative(library
Directory, _INTERNAL_DIR), _LIBRARIES_FILE); | 389 JavaFile librariesFile = new JavaFile.relative(new JavaFile.relative(library
Directory, _INTERNAL_DIR), _LIBRARIES_FILE); |
| 390 try { | 390 try { |
| 391 String contents = librariesFile.readAsStringSync(); | 391 String contents = librariesFile.readAsStringSync(); |
| 392 _libraryMap = new SdkLibrariesReader(useDart2jsPaths).readFromFile(librari
esFile, contents); | 392 _libraryMap = new SdkLibrariesReader(useDart2jsPaths).readFromFile(librari
esFile, contents); |
| 393 } on JavaException catch (exception) { | 393 } on JavaException catch (exception) { |
| 394 AnalysisEngine.instance.logger.logError2("Could not initialize the library
map from ${librariesFile.getAbsolutePath()}", exception); | 394 AnalysisEngine.instance.logger.logError2("Could not initialize the library
map from ${librariesFile.getAbsolutePath()}", exception); |
| 395 _libraryMap = new LibraryMap(); | 395 _libraryMap = new LibraryMap(); |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 | 398 |
| 399 /** | 399 /** |
| 400 * Initialize the state of the SDK. | 400 * Initialize the state of the SDK. |
| 401 */ | 401 */ |
| 402 void initializeSdk() { | 402 void _initializeSdk() { |
| 403 if (!OSUtilities.isWindows()) { | 403 if (!OSUtilities.isWindows()) { |
| 404 ensureVmIsExecutable(); | 404 _ensureVmIsExecutable(); |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 | 408 |
| 409 /** | 409 /** |
| 410 * Instances of the class `SdkLibrariesReader` read and parse the libraries file | 410 * Instances of the class `SdkLibrariesReader` read and parse the libraries file |
| 411 * (dart-sdk/lib/_internal/libraries.dart) for information about the libraries i
n an SDK. The | 411 * (dart-sdk/lib/_internal/libraries.dart) for information about the libraries i
n an SDK. The |
| 412 * library information is represented as a Dart file containing a single top-lev
el variable whose | 412 * library information is represented as a Dart file containing a single top-lev
el variable whose |
| 413 * value is a const map. The keys of the map are the names of libraries defined
in the SDK and the | 413 * value is a const map. The keys of the map are the names of libraries defined
in the SDK and the |
| 414 * values in the map are info objects defining the library. For example, a subse
t of a typical SDK | 414 * values in the map are info objects defining the library. For example, a subse
t of a typical SDK |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 Parser parser = new Parser(source, errorListener); | 467 Parser parser = new Parser(source, errorListener); |
| 468 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); | 468 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); |
| 469 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(_useDart2jsPaths); | 469 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(_useDart2jsPaths); |
| 470 // If any syntactic errors were found then don't try to visit the AST struct
ure. | 470 // If any syntactic errors were found then don't try to visit the AST struct
ure. |
| 471 if (!errorListener.errorReported) { | 471 if (!errorListener.errorReported) { |
| 472 unit.accept(libraryBuilder); | 472 unit.accept(libraryBuilder); |
| 473 } | 473 } |
| 474 return libraryBuilder.librariesMap; | 474 return libraryBuilder.librariesMap; |
| 475 } | 475 } |
| 476 } | 476 } |
| OLD | NEW |