| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 DirectoryBasedDartSdk(JavaFile sdkDirectory, [bool useDart2jsPaths = false]) { | 236 DirectoryBasedDartSdk(JavaFile sdkDirectory, [bool useDart2jsPaths = false]) { |
| 237 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); | 237 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); |
| 238 _libraryMap = initialLibraryMap(useDart2jsPaths); | 238 _libraryMap = initialLibraryMap(useDart2jsPaths); |
| 239 } | 239 } |
| 240 | 240 |
| 241 @override | 241 @override |
| 242 Source fromFileUri(Uri uri) { | 242 Source fromFileUri(Uri uri) { |
| 243 JavaFile file = new JavaFile.fromUri(uri); | 243 JavaFile file = new JavaFile.fromUri(uri); |
| 244 String filePath = file.getAbsolutePath(); | 244 String filePath = file.getAbsolutePath(); |
| 245 String libPath = libraryDirectory.getAbsolutePath(); | 245 String libPath = libraryDirectory.getAbsolutePath(); |
| 246 if (!filePath.startsWith("${libPath}${JavaFile.separator}")) { | 246 if (!filePath.startsWith("$libPath${JavaFile.separator}")) { |
| 247 return null; | 247 return null; |
| 248 } | 248 } |
| 249 filePath = filePath.substring(libPath.length + 1); | 249 filePath = filePath.substring(libPath.length + 1); |
| 250 for (SdkLibrary library in _libraryMap.sdkLibraries) { | 250 for (SdkLibrary library in _libraryMap.sdkLibraries) { |
| 251 String libraryPath = library.path; | 251 String libraryPath = library.path; |
| 252 if (filePath.replaceAll('\\', '/') == libraryPath) { | 252 if (filePath.replaceAll('\\', '/') == libraryPath) { |
| 253 String path = library.shortName; | 253 String path = library.shortName; |
| 254 try { | 254 try { |
| 255 return new FileBasedSource.con2(parseUriWithException(path), file); | 255 return new FileBasedSource.con2(parseUriWithException(path), file); |
| 256 } on URISyntaxException catch (exception) { | 256 } on URISyntaxException catch (exception) { |
| 257 AnalysisEngine.instance.logger.logInformation2("Failed to create URI:
${path}", exception); | 257 AnalysisEngine.instance.logger.logInformation2("Failed to create URI:
$path", exception); |
| 258 return null; | 258 return null; |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 libraryPath = new JavaFile(libraryPath).getParent(); | 261 libraryPath = new JavaFile(libraryPath).getParent(); |
| 262 if (filePath.startsWith("${libraryPath}${JavaFile.separator}")) { | 262 if (filePath.startsWith("$libraryPath${JavaFile.separator}")) { |
| 263 String path = "${library.shortName}/${filePath.substring(libraryPath.len
gth + 1)}"; | 263 String path = "${library.shortName}/${filePath.substring(libraryPath.len
gth + 1)}"; |
| 264 try { | 264 try { |
| 265 return new FileBasedSource.con2(parseUriWithException(path), file); | 265 return new FileBasedSource.con2(parseUriWithException(path), file); |
| 266 } on URISyntaxException catch (exception) { | 266 } on URISyntaxException catch (exception) { |
| 267 AnalysisEngine.instance.logger.logInformation2("Failed to create URI:
${path}", exception); | 267 AnalysisEngine.instance.logger.logInformation2("Failed to create URI:
$path", exception); |
| 268 return null; | 268 return null; |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 return null; | 272 return null; |
| 273 } | 273 } |
| 274 | 274 |
| 275 @override | 275 @override |
| 276 AnalysisContext get context { | 276 AnalysisContext get context { |
| 277 if (_analysisContext == null) { | 277 if (_analysisContext == null) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 * @param libraryName the name of the library associated with the documentatio
n file to be | 362 * @param libraryName the name of the library associated with the documentatio
n file to be |
| 363 * returned | 363 * returned |
| 364 * @return the auxiliary documentation file for the library | 364 * @return the auxiliary documentation file for the library |
| 365 */ | 365 */ |
| 366 JavaFile getDocFileFor(String libraryName) { | 366 JavaFile getDocFileFor(String libraryName) { |
| 367 JavaFile dir = docDirectory; | 367 JavaFile dir = docDirectory; |
| 368 if (!dir.exists()) { | 368 if (!dir.exists()) { |
| 369 return null; | 369 return null; |
| 370 } | 370 } |
| 371 JavaFile libDir = new JavaFile.relative(dir, libraryName); | 371 JavaFile libDir = new JavaFile.relative(dir, libraryName); |
| 372 JavaFile docFile = new JavaFile.relative(libDir, "${libraryName}${_DOC_FILE_
SUFFIX}"); | 372 JavaFile docFile = new JavaFile.relative(libDir, "$libraryName$_DOC_FILE_SUF
FIX"); |
| 373 if (docFile.exists()) { | 373 if (docFile.exists()) { |
| 374 return docFile; | 374 return docFile; |
| 375 } | 375 } |
| 376 return null; | 376 return null; |
| 377 } | 377 } |
| 378 | 378 |
| 379 /** | 379 /** |
| 380 * Return the directory within the SDK directory that contains the libraries. | 380 * Return the directory within the SDK directory that contains the libraries. |
| 381 * | 381 * |
| 382 * @return the directory that contains the libraries | 382 * @return the directory that contains the libraries |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 Parser parser = new Parser(source, errorListener); | 606 Parser parser = new Parser(source, errorListener); |
| 607 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); | 607 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); |
| 608 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(_useDart2jsPaths); | 608 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(_useDart2jsPaths); |
| 609 // If any syntactic errors were found then don't try to visit the AST struct
ure. | 609 // If any syntactic errors were found then don't try to visit the AST struct
ure. |
| 610 if (!errorListener.errorReported) { | 610 if (!errorListener.errorReported) { |
| 611 unit.accept(libraryBuilder); | 611 unit.accept(libraryBuilder); |
| 612 } | 612 } |
| 613 return libraryBuilder.librariesMap; | 613 return libraryBuilder.librariesMap; |
| 614 } | 614 } |
| 615 } | 615 } |
| OLD | NEW |