Chromium Code Reviews| Index: pkg/analyzer/lib/src/generated/sdk_io.dart |
| diff --git a/pkg/analyzer/lib/src/generated/sdk_io.dart b/pkg/analyzer/lib/src/generated/sdk_io.dart |
| index 1fc4b3364545df0108ee8fb3b384e06daee32a95..68efa4696ea5ca7aa9718e4370ea78171160238e 100644 |
| --- a/pkg/analyzer/lib/src/generated/sdk_io.dart |
| +++ b/pkg/analyzer/lib/src/generated/sdk_io.dart |
| @@ -4,6 +4,7 @@ |
| library analyzer.src.generated.sdk_io; |
| +import 'dart:collection'; |
| import 'dart:io'; |
| import 'package:analyzer/src/context/context.dart'; |
| @@ -201,6 +202,11 @@ class DirectoryBasedDartSdk implements DartSdk { |
| JavaFile _sdkDirectory; |
| /** |
| + * The directory within the SDK directory that contains the libraries. |
| + */ |
| + JavaFile _libraryDirectory; |
| + |
| + /** |
| * The revision number of this SDK, or `"0"` if the revision number cannot be |
| * discovered. |
| */ |
| @@ -232,6 +238,11 @@ class DirectoryBasedDartSdk implements DartSdk { |
| LibraryMap _libraryMap; |
| /** |
| + * The mapping from Dart URI's to the corresponding sources. |
| + */ |
| + Map<String, Source> _uriToSourceMap = new HashMap<String, Source>(); |
| + |
| + /** |
| * Initialize a newly created SDK to represent the Dart SDK installed in the |
| * [sdkDirectory]. The flag [useDart2jsPaths] is `true` if the dart2js path |
| * should be used when it is available |
| @@ -333,8 +344,13 @@ class DirectoryBasedDartSdk implements DartSdk { |
| /** |
| * Return the directory within the SDK directory that contains the libraries. |
| */ |
| - JavaFile get libraryDirectory => |
| - new JavaFile.relative(_sdkDirectory, _LIB_DIRECTORY_NAME); |
| + JavaFile get libraryDirectory { |
| + if (_libraryDirectory == null) { |
| + _libraryDirectory = |
| + new JavaFile.relative(_sdkDirectory, _LIB_DIRECTORY_NAME); |
| + } |
| + return _libraryDirectory; |
| + } |
| /** |
| * Return the file containing the Pub executable, or `null` if it does not exist. |
| @@ -492,6 +508,7 @@ class DirectoryBasedDartSdk implements DartSdk { |
| * is available. Return the initialized library map. |
| */ |
| LibraryMap initialLibraryMap(bool useDart2jsPaths) { |
| + print('initialLibraryMap'); |
|
Brian Wilkerson
2016/01/12 20:23:36
Remove?
|
| List<String> searchedPaths = <String>[]; |
| var lastStackTrace = null; |
| var lastException = null; |
| @@ -514,6 +531,35 @@ class DirectoryBasedDartSdk implements DartSdk { |
| @override |
| Source mapDartUri(String dartUri) { |
| + Source source = _uriToSourceMap[dartUri]; |
| + if (source == null) { |
| + source = _mapDartUri(dartUri); |
| + _uriToSourceMap[dartUri] = source; |
| + } |
| + return source; |
| + } |
| + |
| + /** |
| + * Return the [SdkBundle] for this SDK, if it exists, or `null` otherwise. |
| + */ |
| + SdkBundle _getSummarySdkBundle() { |
| + String rootPath = directory.getAbsolutePath(); |
| + String path = pathos.join(rootPath, 'lib', '_internal', 'analysis_summary'); |
| + try { |
| + File file = new File(path); |
| + if (file.existsSync()) { |
| + List<int> bytes = file.readAsBytesSync(); |
| + return new SdkBundle.fromBuffer(bytes); |
| + } |
| + } catch (exception, stackTrace) { |
| + AnalysisEngine.instance.logger.logError( |
| + 'Failed to load SDK analysis summary from $path', |
| + new CaughtException(exception, stackTrace)); |
| + } |
| + return null; |
| + } |
| + |
| + FileBasedSource _mapDartUri(String dartUri) { |
| String libraryName; |
| String relativePath; |
| int index = dartUri.indexOf('/'); |
| @@ -541,26 +587,6 @@ class DirectoryBasedDartSdk implements DartSdk { |
| } |
| /** |
| - * Return the [SdkBundle] for this SDK, if it exists, or `null` otherwise. |
| - */ |
| - SdkBundle _getSummarySdkBundle() { |
| - String rootPath = directory.getAbsolutePath(); |
| - String path = pathos.join(rootPath, 'lib', '_internal', 'analysis_summary'); |
| - try { |
| - File file = new File(path); |
| - if (file.existsSync()) { |
| - List<int> bytes = file.readAsBytesSync(); |
| - return new SdkBundle.fromBuffer(bytes); |
| - } |
| - } catch (exception, stackTrace) { |
| - AnalysisEngine.instance.logger.logError( |
| - 'Failed to load SDK analysis summary from $path', |
| - new CaughtException(exception, stackTrace)); |
| - } |
| - return null; |
| - } |
| - |
| - /** |
| * Return the given [file] if it exists and is executable, or `null` if it |
| * does not exist or is not executable. |
| */ |