Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: pkg/analyzer/lib/src/dart/analysis/file_state.dart

Issue 2517513005: Compute and flush only affected transitive signatures in FileState. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | pkg/analyzer/test/src/dart/analysis/file_state_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698