| Index: pkg/analyzer/lib/src/dart/analysis/file_state.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
|
| index 11e3674946d17b84a8a4341eea58c226bfca8492..ae3fad2603a2ea1f410f3624a7c72e7e6b92b337 100644
|
| --- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
|
| +++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
|
| @@ -25,6 +25,7 @@ import 'package:analyzer/src/summary/api_signature.dart';
|
| import 'package:analyzer/src/summary/format.dart';
|
| import 'package:analyzer/src/summary/idl.dart';
|
| import 'package:analyzer/src/summary/name_filter.dart';
|
| +import 'package:analyzer/src/summary/package_bundle_reader.dart';
|
| import 'package:analyzer/src/summary/summarize_ast.dart';
|
| import 'package:convert/convert.dart';
|
| import 'package:crypto/crypto.dart';
|
| @@ -595,6 +596,18 @@ class FileSystemState {
|
| final Uint32List _salt;
|
|
|
| /**
|
| + * The optional store with externally provided unlinked and corresponding
|
| + * linked summaries. These summaries are always added to the store for any
|
| + * file analysis.
|
| + *
|
| + * While walking the file graph, when we reach a file that exists in the
|
| + * external store, we don't add it.
|
| + *
|
| + * TODO(scheglov) document some more
|
| + */
|
| + final SummaryDataStore externalSummaries;
|
| +
|
| + /**
|
| * Mapping from a URI to the corresponding [FileState].
|
| */
|
| final Map<Uri, FileState> _uriToFile = {};
|
| @@ -633,7 +646,8 @@ class FileSystemState {
|
| this._resourceProvider,
|
| this._sourceFactory,
|
| this._analysisOptions,
|
| - this._salt) {
|
| + this._salt,
|
| + {this.externalSummaries}) {
|
| _testView = new FileSystemStateTestView(this);
|
| }
|
|
|
| @@ -685,12 +699,23 @@ class FileSystemState {
|
| FileState getFileForUri(Uri uri) {
|
| FileState file = _uriToFile[uri];
|
| if (file == null) {
|
| - Source uriSource = _sourceFactory.resolveUri(null, uri.toString());
|
| + String uriStr = uri.toString();
|
| +
|
| + // If the external store has this URI, don't create the file for it.
|
| + // We are given all required unlinked and linked summaries for it.
|
| + if (externalSummaries != null &&
|
| + externalSummaries.hasUnlinkedUnit(uriStr)) {
|
| + return null;
|
| + }
|
| +
|
| + Source uriSource = _sourceFactory.resolveUri(null, uriStr);
|
| +
|
| // If the URI is invalid, for example package:/test/d.dart (note the
|
| // leading '/'), then `null` is returned. We should ignore this URI.
|
| if (uriSource == null) {
|
| return null;
|
| }
|
| +
|
| String path = uriSource.fullName;
|
| File resource = _resourceProvider.getFile(path);
|
| FileSource source = new FileSource(resource, uri);
|
| @@ -756,6 +781,9 @@ class FileSystemState {
|
| _pathToFiles[path] = files;
|
| }
|
| files.add(file);
|
| + if (file.uri.scheme != 'package') {
|
| + _pathToCanonicalFile[path] = file;
|
| + }
|
| }
|
| }
|
|
|
|
|