| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 * A mapping from Dart library URI's to the library represented by that URI. | 81 * A mapping from Dart library URI's to the library represented by that URI. |
| 82 */ | 82 */ |
| 83 LibraryMap _libraryMap; | 83 LibraryMap _libraryMap; |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * The name of the directory within the SDK directory that contains executable
s. | 86 * The name of the directory within the SDK directory that contains executable
s. |
| 87 */ | 87 */ |
| 88 static String _BIN_DIRECTORY_NAME = "bin"; | 88 static String _BIN_DIRECTORY_NAME = "bin"; |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * The name of the directory on Mac that contains dartium. | |
| 92 */ | |
| 93 static String _DARTIUM_DIRECTORY_NAME_MAC = "Chromium.app"; | |
| 94 | |
| 95 /** | |
| 96 * The name of the directory on non-Mac that contains dartium. | 91 * The name of the directory on non-Mac that contains dartium. |
| 97 */ | 92 */ |
| 98 static String _DARTIUM_DIRECTORY_NAME = "chromium"; | 93 static String _DARTIUM_DIRECTORY_NAME = "chromium"; |
| 99 | 94 |
| 100 /** | 95 /** |
| 101 * The name of the dart2js executable on non-windows operating systems. | 96 * The name of the dart2js executable on non-windows operating systems. |
| 102 */ | 97 */ |
| 103 static String _DART2JS_EXECUTABLE_NAME = "dart2js"; | 98 static String _DART2JS_EXECUTABLE_NAME = "dart2js"; |
| 104 | 99 |
| 105 /** | 100 /** |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 220 |
| 226 /** | 221 /** |
| 227 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. | 222 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. |
| 228 * | 223 * |
| 229 * @param sdkDirectory the directory containing the SDK | 224 * @param sdkDirectory the directory containing the SDK |
| 230 * @param useDart2jsPaths `true` if the dart2js path should be used when it is
available | 225 * @param useDart2jsPaths `true` if the dart2js path should be used when it is
available |
| 231 */ | 226 */ |
| 232 DirectoryBasedDartSdk(JavaFile sdkDirectory, [bool useDart2jsPaths = false]) { | 227 DirectoryBasedDartSdk(JavaFile sdkDirectory, [bool useDart2jsPaths = false]) { |
| 233 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); | 228 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); |
| 234 _libraryMap = initialLibraryMap(useDart2jsPaths); | 229 _libraryMap = initialLibraryMap(useDart2jsPaths); |
| 235 _analysisContext = new AnalysisContextImpl(); | |
| 236 _analysisContext.sourceFactory = new SourceFactory([new DartUriResolver(this
)]); | |
| 237 List<String> uris = this.uris; | |
| 238 ChangeSet changeSet = new ChangeSet(); | |
| 239 for (String uri in uris) { | |
| 240 changeSet.addedSource(_analysisContext.sourceFactory.forUri(uri)); | |
| 241 } | |
| 242 _analysisContext.applyChanges(changeSet); | |
| 243 } | 230 } |
| 244 | 231 |
| 245 @override | 232 @override |
| 246 Source fromEncoding(UriKind kind, Uri uri) => new FileBasedSource.con2(new Jav
aFile.fromUri(uri), kind); | 233 Source fromEncoding(UriKind kind, Uri uri) => new FileBasedSource.con2(new Jav
aFile.fromUri(uri), kind); |
| 247 | 234 |
| 248 @override | 235 @override |
| 249 AnalysisContext get context => _analysisContext; | 236 AnalysisContext get context { |
| 237 if (_analysisContext == null) { |
| 238 _analysisContext = new AnalysisContextImpl(); |
| 239 _analysisContext.sourceFactory = new SourceFactory([new DartUriResolver(th
is)]); |
| 240 List<String> uris = this.uris; |
| 241 ChangeSet changeSet = new ChangeSet(); |
| 242 for (String uri in uris) { |
| 243 changeSet.addedSource(_analysisContext.sourceFactory.forUri(uri)); |
| 244 } |
| 245 _analysisContext.applyChanges(changeSet); |
| 246 } |
| 247 return _analysisContext; |
| 248 } |
| 250 | 249 |
| 251 /** | 250 /** |
| 252 * Return the file containing the dart2js executable, or `null` if it does not
exist. | 251 * Return the file containing the dart2js executable, or `null` if it does not
exist. |
| 253 * | 252 * |
| 254 * @return the file containing the dart2js executable | 253 * @return the file containing the dart2js executable |
| 255 */ | 254 */ |
| 256 JavaFile get dart2JsExecutable { | 255 JavaFile get dart2JsExecutable { |
| 257 if (_dart2jsExecutable == null) { | 256 if (_dart2jsExecutable == null) { |
| 258 _dart2jsExecutable = _verifyExecutable(new JavaFile.relative(new JavaFile.
relative(_sdkDirectory, _BIN_DIRECTORY_NAME), OSUtilities.isWindows() ? _DART2JS
_EXECUTABLE_NAME_WIN : _DART2JS_EXECUTABLE_NAME)); | 257 _dart2jsExecutable = _verifyExecutable(new JavaFile.relative(new JavaFile.
relative(_sdkDirectory, _BIN_DIRECTORY_NAME), OSUtilities.isWindows() ? _DART2JS
_EXECUTABLE_NAME_WIN : _DART2JS_EXECUTABLE_NAME)); |
| 259 } | 258 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 Parser parser = new Parser(source, errorListener); | 545 Parser parser = new Parser(source, errorListener); |
| 547 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); | 546 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); |
| 548 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(_useDart2jsPaths); | 547 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(_useDart2jsPaths); |
| 549 // If any syntactic errors were found then don't try to visit the AST struct
ure. | 548 // If any syntactic errors were found then don't try to visit the AST struct
ure. |
| 550 if (!errorListener.errorReported) { | 549 if (!errorListener.errorReported) { |
| 551 unit.accept(libraryBuilder); | 550 unit.accept(libraryBuilder); |
| 552 } | 551 } |
| 553 return libraryBuilder.librariesMap; | 552 return libraryBuilder.librariesMap; |
| 554 } | 553 } |
| 555 } | 554 } |
| OLD | NEW |