| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.sdk.io; | 4 library engine.sdk.io; |
| 5 | 5 |
| 6 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 import 'java_io.dart'; | 7 import 'java_io.dart'; |
| 8 import 'java_engine_io.dart'; | 8 import 'java_engine_io.dart'; |
| 9 import 'source_io.dart'; | 9 import 'source_io.dart'; |
| 10 import 'error.dart'; | 10 import 'error.dart'; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 * The name of the directory within the SDK directory that contains executable
s. | 55 * The name of the directory within the SDK directory that contains executable
s. |
| 56 */ | 56 */ |
| 57 static String _BIN_DIRECTORY_NAME = "bin"; | 57 static String _BIN_DIRECTORY_NAME = "bin"; |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * The name of the directory within the SDK directory that contains Chromium. | 60 * The name of the directory within the SDK directory that contains Chromium. |
| 61 */ | 61 */ |
| 62 static String _CHROMIUM_DIRECTORY_NAME = "chromium"; | 62 static String _CHROMIUM_DIRECTORY_NAME = "chromium"; |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * The name of the environment variable whose value is the path to the default
Dart SDK directory. | |
| 66 */ | |
| 67 static String _DART_SDK_ENVIRONMENT_VARIABLE_NAME = "DART_SDK"; | |
| 68 | |
| 69 /** | |
| 70 * The name of the file containing the Dartium executable on Linux. | 65 * The name of the file containing the Dartium executable on Linux. |
| 71 */ | 66 */ |
| 72 static String _DARTIUM_EXECUTABLE_NAME_LINUX = "chrome"; | 67 static String _DARTIUM_EXECUTABLE_NAME_LINUX = "chrome"; |
| 73 | 68 |
| 74 /** | 69 /** |
| 75 * The name of the file containing the Dartium executable on Macintosh. | 70 * The name of the file containing the Dartium executable on Macintosh. |
| 76 */ | 71 */ |
| 77 static String _DARTIUM_EXECUTABLE_NAME_MAC = "Chromium.app/Contents/MacOS/Chro
mium"; | 72 static String _DARTIUM_EXECUTABLE_NAME_MAC = "Chromium.app/Contents/MacOS/Chro
mium"; |
| 78 | 73 |
| 79 /** | 74 /** |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 */ | 142 */ |
| 148 static DirectoryBasedDartSdk get defaultSdk { | 143 static DirectoryBasedDartSdk get defaultSdk { |
| 149 JavaFile sdkDirectory = defaultSdkDirectory; | 144 JavaFile sdkDirectory = defaultSdkDirectory; |
| 150 if (sdkDirectory == null) { | 145 if (sdkDirectory == null) { |
| 151 return null; | 146 return null; |
| 152 } | 147 } |
| 153 return new DirectoryBasedDartSdk(sdkDirectory); | 148 return new DirectoryBasedDartSdk(sdkDirectory); |
| 154 } | 149 } |
| 155 | 150 |
| 156 /** | 151 /** |
| 157 * Return the default Dart SDK, or `null` if the directory containing the defa
ult SDK cannot | |
| 158 * be determined (or does not exist). | |
| 159 * | |
| 160 * Added in order to test AnalysisContextImpl2. | |
| 161 * | |
| 162 * @return the default Dart SDK | |
| 163 */ | |
| 164 static DirectoryBasedDartSdk get defaultSdk2 { | |
| 165 JavaFile sdkDirectory = defaultSdkDirectory; | |
| 166 if (sdkDirectory == null) { | |
| 167 return null; | |
| 168 } | |
| 169 return new DirectoryBasedDartSdk.con1(sdkDirectory, true); | |
| 170 } | |
| 171 | |
| 172 /** | |
| 173 * Return the default directory for the Dart SDK, or `null` if the directory c
annot be | 152 * Return the default directory for the Dart SDK, or `null` if the directory c
annot be |
| 174 * determined (or does not exist). The default directory is provided by a [Sys
tem] property | 153 * determined (or does not exist). The default directory is provided by a [Sys
tem] property |
| 175 * named `com.google.dart.sdk`, or, if the property is not defined, an environ
ment variable | 154 * named `com.google.dart.sdk`. |
| 176 * named `DART_SDK`. | |
| 177 * | 155 * |
| 178 * @return the default directory for the Dart SDK | 156 * @return the default directory for the Dart SDK |
| 179 */ | 157 */ |
| 180 static JavaFile get defaultSdkDirectory { | 158 static JavaFile get defaultSdkDirectory { |
| 181 String sdkProperty = JavaSystemIO.getProperty(_DEFAULT_DIRECTORY_PROPERTY_NA
ME); | 159 String sdkProperty = JavaSystemIO.getProperty(_DEFAULT_DIRECTORY_PROPERTY_NA
ME); |
| 182 if (sdkProperty == null) { | 160 if (sdkProperty == null) { |
| 183 sdkProperty = JavaSystemIO.getenv(_DART_SDK_ENVIRONMENT_VARIABLE_NAME); | 161 return null; |
| 184 if (sdkProperty == null) { | |
| 185 return null; | |
| 186 } | |
| 187 } | 162 } |
| 188 JavaFile sdkDirectory = new JavaFile(sdkProperty); | 163 JavaFile sdkDirectory = new JavaFile(sdkProperty); |
| 189 if (!sdkDirectory.exists()) { | 164 if (!sdkDirectory.exists()) { |
| 190 return null; | 165 return null; |
| 191 } | 166 } |
| 192 return sdkDirectory; | 167 return sdkDirectory; |
| 193 } | 168 } |
| 194 | 169 |
| 195 /** | 170 /** |
| 196 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. | 171 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 * | 439 * |
| 465 * @coverage dart.engine.sdk | 440 * @coverage dart.engine.sdk |
| 466 */ | 441 */ |
| 467 class SdkLibrariesReader { | 442 class SdkLibrariesReader { |
| 468 /** | 443 /** |
| 469 * Return the library map read from the given source. | 444 * Return the library map read from the given source. |
| 470 * | 445 * |
| 471 * @return the library map read from the given source | 446 * @return the library map read from the given source |
| 472 */ | 447 */ |
| 473 LibraryMap readFrom(JavaFile librariesFile, String libraryFileContents) { | 448 LibraryMap readFrom(JavaFile librariesFile, String libraryFileContents) { |
| 474 List<bool> foundError = [false]; | 449 BooleanErrorListener errorListener = new BooleanErrorListener(); |
| 475 AnalysisErrorListener errorListener = new AnalysisErrorListener_11(foundErro
r); | |
| 476 Source source = new FileBasedSource.con2(null, librariesFile, UriKind.FILE_U
RI); | 450 Source source = new FileBasedSource.con2(null, librariesFile, UriKind.FILE_U
RI); |
| 477 Scanner scanner = new Scanner(source, new CharSequenceReader(new CharSequenc
e(libraryFileContents)), errorListener); | 451 Scanner scanner = new Scanner(source, new CharSequenceReader(new CharSequenc
e(libraryFileContents)), errorListener); |
| 478 Parser parser = new Parser(source, errorListener); | 452 Parser parser = new Parser(source, errorListener); |
| 479 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); | 453 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); |
| 480 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(); | 454 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(); |
| 481 if (!foundError[0]) { | 455 if (!errorListener.errorReported) { |
| 482 unit.accept(libraryBuilder); | 456 unit.accept(libraryBuilder); |
| 483 } | 457 } |
| 484 return libraryBuilder.librariesMap; | 458 return libraryBuilder.librariesMap; |
| 485 } | 459 } |
| 486 } | 460 } |
| 487 | 461 |
| 488 class SdkLibrariesReader_LibraryBuilder extends RecursiveASTVisitor<Object> { | 462 class SdkLibrariesReader_LibraryBuilder extends RecursiveASTVisitor<Object> { |
| 489 /** | 463 /** |
| 490 * The prefix added to the name of a library to form the URI used in code to r
eference the | 464 * The prefix added to the name of a library to form the URI used in code to r
eference the |
| 491 * library. | 465 * library. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 library.setDart2JsLibrary(); | 531 library.setDart2JsLibrary(); |
| 558 } | 532 } |
| 559 } | 533 } |
| 560 } | 534 } |
| 561 } | 535 } |
| 562 } | 536 } |
| 563 librariesMap.setLibrary(libraryName, library); | 537 librariesMap.setLibrary(libraryName, library); |
| 564 } | 538 } |
| 565 return null; | 539 return null; |
| 566 } | 540 } |
| 567 } | |
| 568 | |
| 569 class AnalysisErrorListener_11 implements AnalysisErrorListener { | |
| 570 List<bool> foundError; | |
| 571 | |
| 572 AnalysisErrorListener_11(this.foundError); | |
| 573 | |
| 574 void onError(AnalysisError error) { | |
| 575 if (error != null && error.errorCode.type != ErrorType.TODO) { | |
| 576 foundError[0] = true; | |
| 577 } | |
| 578 } | |
| 579 } | 541 } |
| OLD | NEW |