| 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 library engine.sdk.io; | 3 library engine.sdk.io; |
| 4 import 'java_core.dart'; | 4 import 'java_core.dart'; |
| 5 import 'java_io.dart'; | 5 import 'java_io.dart'; |
| 6 import 'java_engine_io.dart'; | 6 import 'java_engine_io.dart'; |
| 7 import 'source_io.dart'; | 7 import 'source_io.dart'; |
| 8 import 'error.dart'; | 8 import 'error.dart'; |
| 9 import 'scanner.dart'; | 9 import 'scanner.dart'; |
| 10 import 'ast.dart'; | 10 import 'ast.dart'; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 /** | 193 /** |
| 194 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. | 194 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. |
| 195 * | 195 * |
| 196 * @param sdkDirectory the directory containing the SDK | 196 * @param sdkDirectory the directory containing the SDK |
| 197 */ | 197 */ |
| 198 DirectoryBasedDartSdk(JavaFile sdkDirectory) { | 198 DirectoryBasedDartSdk(JavaFile sdkDirectory) { |
| 199 this.directory = sdkDirectory.getAbsoluteFile(); | 199 this.directory = sdkDirectory.getAbsoluteFile(); |
| 200 initializeSdk(); | 200 initializeSdk(); |
| 201 initializeLibraryMap(); | 201 initializeLibraryMap(); |
| 202 if (AnalysisEngine.instance.useExperimentalContext) { | 202 _analysisContext = new AnalysisContextImpl(); |
| 203 _analysisContext = new AnalysisContextImpl2(); | |
| 204 } else { | |
| 205 _analysisContext = new AnalysisContextImpl(); | |
| 206 } | |
| 207 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); | 203 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); |
| 208 List<String> uris = this.uris; | 204 List<String> uris = this.uris; |
| 209 ChangeSet changeSet = new ChangeSet(); | 205 ChangeSet changeSet = new ChangeSet(); |
| 210 for (String uri in uris) { | 206 for (String uri in uris) { |
| 211 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); | 207 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); |
| 212 } | 208 } |
| 213 _analysisContext.applyChanges(changeSet); | 209 _analysisContext.applyChanges(changeSet); |
| 214 } | 210 } |
| 215 | 211 |
| 216 /** | 212 /** |
| 217 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. | 213 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. |
| 218 * | 214 * |
| 219 * Added in order to test AnalysisContextImpl2. | 215 * Added in order to test AnalysisContextImpl2. |
| 220 * | 216 * |
| 221 * @param sdkDirectory the directory containing the SDK | 217 * @param sdkDirectory the directory containing the SDK |
| 222 */ | 218 */ |
| 223 DirectoryBasedDartSdk.con1(JavaFile sdkDirectory, bool ignored) { | 219 DirectoryBasedDartSdk.con1(JavaFile sdkDirectory, bool ignored) { |
| 224 this.directory = sdkDirectory.getAbsoluteFile(); | 220 this.directory = sdkDirectory.getAbsoluteFile(); |
| 225 initializeSdk(); | 221 initializeSdk(); |
| 226 initializeLibraryMap(); | 222 initializeLibraryMap(); |
| 227 _analysisContext = new AnalysisContextImpl2(); | 223 _analysisContext = new AnalysisContextImpl(); |
| 228 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); | 224 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); |
| 229 List<String> uris = this.uris; | 225 List<String> uris = this.uris; |
| 230 ChangeSet changeSet = new ChangeSet(); | 226 ChangeSet changeSet = new ChangeSet(); |
| 231 for (String uri in uris) { | 227 for (String uri in uris) { |
| 232 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); | 228 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); |
| 233 } | 229 } |
| 234 _analysisContext.applyChanges(changeSet); | 230 _analysisContext.applyChanges(changeSet); |
| 235 } | 231 } |
| 236 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) => new F
ileBasedSource.con2(contentCache, new JavaFile.fromUri(uri), kind); | 232 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) => new F
ileBasedSource.con2(contentCache, new JavaFile.fromUri(uri), kind); |
| 237 AnalysisContext get context => _analysisContext; | 233 AnalysisContext get context => _analysisContext; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 */ | 458 */ |
| 463 class SdkLibrariesReader { | 459 class SdkLibrariesReader { |
| 464 | 460 |
| 465 /** | 461 /** |
| 466 * Return the library map read from the given source. | 462 * Return the library map read from the given source. |
| 467 * | 463 * |
| 468 * @return the library map read from the given source | 464 * @return the library map read from the given source |
| 469 */ | 465 */ |
| 470 LibraryMap readFrom(JavaFile librariesFile, String libraryFileContents) { | 466 LibraryMap readFrom(JavaFile librariesFile, String libraryFileContents) { |
| 471 List<bool> foundError = [false]; | 467 List<bool> foundError = [false]; |
| 472 AnalysisErrorListener errorListener = new AnalysisErrorListener_9(foundError
); | 468 AnalysisErrorListener errorListener = new AnalysisErrorListener_8(foundError
); |
| 473 Source source = new FileBasedSource.con2(null, librariesFile, UriKind.FILE_U
RI); | 469 Source source = new FileBasedSource.con2(null, librariesFile, UriKind.FILE_U
RI); |
| 474 StringScanner scanner = new StringScanner(source, libraryFileContents, error
Listener); | 470 StringScanner scanner = new StringScanner(source, libraryFileContents, error
Listener); |
| 475 Parser parser = new Parser(source, errorListener); | 471 Parser parser = new Parser(source, errorListener); |
| 476 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); | 472 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); |
| 477 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(); | 473 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(); |
| 478 if (!foundError[0]) { | 474 if (!foundError[0]) { |
| 479 unit.accept(libraryBuilder); | 475 unit.accept(libraryBuilder); |
| 480 } | 476 } |
| 481 return libraryBuilder.librariesMap; | 477 return libraryBuilder.librariesMap; |
| 482 } | 478 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 } | 550 } |
| 555 } | 551 } |
| 556 } | 552 } |
| 557 } | 553 } |
| 558 } | 554 } |
| 559 librariesMap.setLibrary(libraryName, library); | 555 librariesMap.setLibrary(libraryName, library); |
| 560 } | 556 } |
| 561 return null; | 557 return null; |
| 562 } | 558 } |
| 563 } | 559 } |
| 564 class AnalysisErrorListener_9 implements AnalysisErrorListener { | 560 class AnalysisErrorListener_8 implements AnalysisErrorListener { |
| 565 List<bool> foundError; | 561 List<bool> foundError; |
| 566 AnalysisErrorListener_9(this.foundError); | 562 AnalysisErrorListener_8(this.foundError); |
| 567 void onError(AnalysisError error) { | 563 void onError(AnalysisError error) { |
| 568 foundError[0] = true; | 564 foundError[0] = true; |
| 569 } | 565 } |
| 570 } | 566 } |
| OLD | NEW |