Chromium Code Reviews| 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 da38aca60b5fb54ea9731776aa7ac39e63d9cf14..93d172c5bdb2f2bde95899a4eeb3878af75471fb 100644 |
| --- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart |
| +++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart |
| @@ -93,6 +93,7 @@ class FileState { |
| List<FileState> _partedFiles; |
| Set<FileState> _directReferencedFiles = new Set<FileState>(); |
| Set<FileState> _transitiveFiles; |
| + String _transitiveSignature; |
| FileState._(this._fsState, this.path, this.uri, this.source); |
| @@ -179,6 +180,23 @@ class FileState { |
| } |
| /** |
| + * Return the signature of the file, based on the [transitiveFiles]. |
| + */ |
| + String get transitiveSignature { |
| + if (_transitiveSignature == null) { |
| + ApiSignature signature = new ApiSignature(); |
| + signature.addUint32List(_fsState._salt); |
| + signature.addString(_fsState._sdkApiSignature); |
| + transitiveFiles |
|
Paul Berry
2016/11/21 13:58:00
It *probably* won't matter, but for safety, we sho
scheglov
2016/11/21 16:51:52
Done.
|
| + .map((file) => file.apiSignature) |
| + .forEach(signature.addBytes); |
| + signature.addString(uri.toString()); |
| + _transitiveSignature = signature.toHex(); |
| + } |
| + return _transitiveSignature; |
| + } |
| + |
| + /** |
| * The [UnlinkedUnit] of the file. |
| */ |
| UnlinkedUnit get unlinked => _unlinked; |
| @@ -267,6 +285,16 @@ class FileState { |
| !_equalByteLists(_apiSignature, newApiSignature); |
| _apiSignature = newApiSignature; |
| + // If the API signature changed, flush transitive signatures. |
| + if (apiSignatureChanged) { |
| + for (FileState file in _fsState._uriToFile.values) { |
| + if (file._transitiveFiles != null && |
| + file._transitiveFiles.contains(this)) { |
| + file._transitiveSignature = null; |
| + } |
| + } |
| + } |
| + |
| // This file is potentially not a library for its previous parts anymore. |
| if (_partedFiles != null) { |
| for (FileState part in _partedFiles) { |
| @@ -382,6 +410,7 @@ class FileSystemState { |
| final SourceFactory _sourceFactory; |
| final AnalysisOptions _analysisOptions; |
| final Uint32List _salt; |
| + final String _sdkApiSignature; |
| /** |
| * Mapping from a URI to the corresponding [FileState]. |
| @@ -412,7 +441,8 @@ class FileSystemState { |
| this._resourceProvider, |
| this._sourceFactory, |
| this._analysisOptions, |
| - this._salt) { |
| + this._salt, |
| + this._sdkApiSignature) { |
| _testView = new FileSystemStateTestView(this); |
| } |