| 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 @deprecated | 5 @deprecated |
| 6 library analyzer.src.generated.sdk_io; | 6 library analyzer.src.generated.sdk_io; |
| 7 | 7 |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| 11 import 'package:analyzer/dart/ast/ast.dart'; | 11 import 'package:analyzer/dart/ast/ast.dart'; |
| 12 import 'package:analyzer/src/context/context.dart'; | 12 import 'package:analyzer/src/context/context.dart'; |
| 13 import 'package:analyzer/src/dart/scanner/reader.dart'; | 13 import 'package:analyzer/src/dart/scanner/reader.dart'; |
| 14 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 14 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart'; | 15 import 'package:analyzer/src/generated/engine.dart'; |
| 16 import 'package:analyzer/src/generated/error.dart'; | 16 import 'package:analyzer/src/generated/error.dart'; |
| 17 import 'package:analyzer/src/generated/java_core.dart'; | |
| 18 import 'package:analyzer/src/generated/java_engine.dart'; | 17 import 'package:analyzer/src/generated/java_engine.dart'; |
| 19 import 'package:analyzer/src/generated/java_engine_io.dart'; | 18 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 20 import 'package:analyzer/src/generated/java_io.dart'; | 19 import 'package:analyzer/src/generated/java_io.dart'; |
| 21 import 'package:analyzer/src/generated/parser.dart'; | 20 import 'package:analyzer/src/generated/parser.dart'; |
| 22 import 'package:analyzer/src/generated/sdk.dart'; | 21 import 'package:analyzer/src/generated/sdk.dart'; |
| 23 import 'package:analyzer/src/generated/source_io.dart'; | 22 import 'package:analyzer/src/generated/source_io.dart'; |
| 24 import 'package:analyzer/src/summary/idl.dart' show PackageBundle; | 23 import 'package:analyzer/src/summary/idl.dart' show PackageBundle; |
| 25 import 'package:analyzer/src/summary/summary_sdk.dart'; | 24 import 'package:analyzer/src/summary/summary_sdk.dart'; |
| 26 import 'package:path/path.dart' as pathos; | 25 import 'package:path/path.dart' as pathos; |
| 27 | 26 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 125 |
| 127 @override | 126 @override |
| 128 Source fromFileUri(Uri uri) { | 127 Source fromFileUri(Uri uri) { |
| 129 JavaFile file = new JavaFile.fromUri(uri); | 128 JavaFile file = new JavaFile.fromUri(uri); |
| 130 | 129 |
| 131 String path = _getPath(file); | 130 String path = _getPath(file); |
| 132 if (path == null) { | 131 if (path == null) { |
| 133 return null; | 132 return null; |
| 134 } | 133 } |
| 135 try { | 134 try { |
| 136 return new FileBasedSource(file, parseUriWithException(path)); | 135 return new FileBasedSource(file, Uri.parse(path)); |
| 137 } on URISyntaxException catch (exception, stackTrace) { | 136 } on FormatException catch (exception, stackTrace) { |
| 138 AnalysisEngine.instance.logger.logInformation( | 137 AnalysisEngine.instance.logger.logInformation( |
| 139 "Failed to create URI: $path", | 138 "Failed to create URI: $path", |
| 140 new CaughtException(exception, stackTrace)); | 139 new CaughtException(exception, stackTrace)); |
| 141 } | 140 } |
| 142 return null; | 141 return null; |
| 143 } | 142 } |
| 144 | 143 |
| 145 String getRelativePathFromFile(JavaFile file); | 144 String getRelativePathFromFile(JavaFile file); |
| 146 | 145 |
| 147 @override | 146 @override |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 if (index == -1) { | 181 if (index == -1) { |
| 183 return null; | 182 return null; |
| 184 } | 183 } |
| 185 } | 184 } |
| 186 String prefix = libraryPath.substring(0, index + 1); | 185 String prefix = libraryPath.substring(0, index + 1); |
| 187 srcPath = '$prefix$relativePath'; | 186 srcPath = '$prefix$relativePath'; |
| 188 } | 187 } |
| 189 String filePath = srcPath.replaceAll('/', JavaFile.separator); | 188 String filePath = srcPath.replaceAll('/', JavaFile.separator); |
| 190 try { | 189 try { |
| 191 JavaFile file = new JavaFile(filePath); | 190 JavaFile file = new JavaFile(filePath); |
| 192 return new FileBasedSource(file, parseUriWithException(dartUri)); | 191 return new FileBasedSource(file, Uri.parse(dartUri)); |
| 193 } on URISyntaxException { | 192 } on FormatException { |
| 194 return null; | 193 return null; |
| 195 } | 194 } |
| 196 } | 195 } |
| 197 | 196 |
| 198 @override | 197 @override |
| 199 Source mapDartUri(String dartUri) { | 198 Source mapDartUri(String dartUri) { |
| 200 Source source = _uriToSourceMap[dartUri]; | 199 Source source = _uriToSourceMap[dartUri]; |
| 201 if (source == null) { | 200 if (source == null) { |
| 202 source = internalMapDartUri(dartUri); | 201 source = internalMapDartUri(dartUri); |
| 203 _uriToSourceMap[dartUri] = source; | 202 _uriToSourceMap[dartUri] = source; |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 SdkLibrary library = getSdkLibrary(libraryName); | 713 SdkLibrary library = getSdkLibrary(libraryName); |
| 715 if (library == null) { | 714 if (library == null) { |
| 716 return null; | 715 return null; |
| 717 } | 716 } |
| 718 try { | 717 try { |
| 719 JavaFile file = new JavaFile.relative(libraryDirectory, library.path); | 718 JavaFile file = new JavaFile.relative(libraryDirectory, library.path); |
| 720 if (!relativePath.isEmpty) { | 719 if (!relativePath.isEmpty) { |
| 721 file = file.getParentFile(); | 720 file = file.getParentFile(); |
| 722 file = new JavaFile.relative(file, relativePath); | 721 file = new JavaFile.relative(file, relativePath); |
| 723 } | 722 } |
| 724 return new FileBasedSource(file, parseUriWithException(dartUri)); | 723 return new FileBasedSource(file, Uri.parse(dartUri)); |
| 725 } on URISyntaxException { | 724 } on FormatException { |
| 726 return null; | 725 return null; |
| 727 } | 726 } |
| 728 } | 727 } |
| 729 | 728 |
| 730 /** | 729 /** |
| 731 * Return the given [file] if it exists and is executable, or `null` if it | 730 * Return the given [file] if it exists and is executable, or `null` if it |
| 732 * does not exist or is not executable. | 731 * does not exist or is not executable. |
| 733 */ | 732 */ |
| 734 JavaFile _verifyExecutable(JavaFile file) => | 733 JavaFile _verifyExecutable(JavaFile file) => |
| 735 file.isExecutable() ? file : null; | 734 file.isExecutable() ? file : null; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 791 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
| 793 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 792 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
| 794 // If any syntactic errors were found then don't try to visit the AST | 793 // If any syntactic errors were found then don't try to visit the AST |
| 795 // structure. | 794 // structure. |
| 796 if (!errorListener.errorReported) { | 795 if (!errorListener.errorReported) { |
| 797 unit.accept(libraryBuilder); | 796 unit.accept(libraryBuilder); |
| 798 } | 797 } |
| 799 return libraryBuilder.librariesMap; | 798 return libraryBuilder.librariesMap; |
| 800 } | 799 } |
| 801 } | 800 } |
| OLD | NEW |