OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:collection'; | 5 import 'dart:collection'; |
6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
7 | 7 |
8 import 'package:analyzer/file_system/file_system.dart'; | 8 import 'package:analyzer/file_system/file_system.dart'; |
9 import 'package:analyzer/src/dart/analysis/byte_store.dart'; | 9 import 'package:analyzer/src/dart/analysis/byte_store.dart'; |
10 import 'package:analyzer/src/dart/analysis/driver.dart'; | 10 import 'package:analyzer/src/dart/analysis/driver.dart'; |
11 import 'package:analyzer/src/dart/analysis/file_state.dart'; | 11 import 'package:analyzer/src/dart/analysis/file_state.dart'; |
12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
13 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
| 14 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
14 | 15 |
15 /** | 16 /** |
16 * Callback used by [FileTracker] to report to its client that files have been | 17 * Callback used by [FileTracker] to report to its client that files have been |
17 * added, changed, or removed, and therefore more analysis may be necessary. | 18 * added, changed, or removed, and therefore more analysis may be necessary. |
18 */ | 19 */ |
19 typedef void FileTrackerChangeHook(); | 20 typedef void FileTrackerChangeHook(); |
20 | 21 |
21 /** | 22 /** |
22 * Maintains the file system state needed by the analysis driver, as well as | 23 * Maintains the file system state needed by the analysis driver, as well as |
23 * information about files that have changed and the impact of those changes. | 24 * information about files that have changed and the impact of those changes. |
(...skipping 22 matching lines...) Loading... |
46 * The current file system state. | 47 * The current file system state. |
47 */ | 48 */ |
48 final FileSystemState fsState; | 49 final FileSystemState fsState; |
49 | 50 |
50 /** | 51 /** |
51 * The set of added files. | 52 * The set of added files. |
52 */ | 53 */ |
53 final addedFiles = new LinkedHashSet<String>(); | 54 final addedFiles = new LinkedHashSet<String>(); |
54 | 55 |
55 /** | 56 /** |
| 57 * TODO(scheglov) document |
| 58 */ |
| 59 final SummaryDataStore externalSummaries; |
| 60 |
| 61 /** |
56 * The set of files were reported as changed through [changeFile] and not | 62 * The set of files were reported as changed through [changeFile] and not |
57 * checked for actual changes yet. | 63 * checked for actual changes yet. |
58 */ | 64 */ |
59 final _changedFiles = new LinkedHashSet<String>(); | 65 final _changedFiles = new LinkedHashSet<String>(); |
60 | 66 |
61 /** | 67 /** |
62 * The set of files that are currently scheduled for analysis. | 68 * The set of files that are currently scheduled for analysis. |
63 */ | 69 */ |
64 final _pendingFiles = new LinkedHashSet<String>(); | 70 final _pendingFiles = new LinkedHashSet<String>(); |
65 | 71 |
66 FileTracker( | 72 FileTracker( |
67 this.logger, | 73 this.logger, |
68 ByteStore byteStore, | 74 ByteStore byteStore, |
69 FileContentOverlay contentOverlay, | 75 FileContentOverlay contentOverlay, |
70 ResourceProvider resourceProvider, | 76 ResourceProvider resourceProvider, |
71 SourceFactory sourceFactory, | 77 SourceFactory sourceFactory, |
72 AnalysisOptions analysisOptions, | 78 AnalysisOptions analysisOptions, |
73 Uint32List salt, | 79 Uint32List salt, |
| 80 this.externalSummaries, |
74 this._changeHook) | 81 this._changeHook) |
75 : fsState = new FileSystemState(logger, byteStore, contentOverlay, | 82 : fsState = new FileSystemState(logger, byteStore, contentOverlay, |
76 resourceProvider, sourceFactory, analysisOptions, salt); | 83 resourceProvider, sourceFactory, analysisOptions, salt, |
| 84 externalSummaries: externalSummaries); |
77 | 85 |
78 /** | 86 /** |
79 * Returns the path to exactly one that needs analysis. Throws a [StateError] | 87 * Returns the path to exactly one that needs analysis. Throws a [StateError] |
80 * if no files need analysis. | 88 * if no files need analysis. |
81 */ | 89 */ |
82 String get anyPendingFile => _pendingFiles.first; | 90 String get anyPendingFile => _pendingFiles.first; |
83 | 91 |
84 /** | 92 /** |
85 * Returns a boolean indicating whether there are any files that have changed, | 93 * Returns a boolean indicating whether there are any files that have changed, |
86 * but for which the impact of the changes hasn't been measured. | 94 * but for which the impact of the changes hasn't been measured. |
(...skipping 105 matching lines...) Loading... |
192 // If the file has not been accessed yet, we either will eventually read | 200 // If the file has not been accessed yet, we either will eventually read |
193 // it later while analyzing one of the added files, or don't need it. | 201 // it later while analyzing one of the added files, or don't need it. |
194 if (fsState.knownFilePaths.contains(path)) { | 202 if (fsState.knownFilePaths.contains(path)) { |
195 verifyApiSignature(path); | 203 verifyApiSignature(path); |
196 } | 204 } |
197 return true; | 205 return true; |
198 } | 206 } |
199 return false; | 207 return false; |
200 } | 208 } |
201 } | 209 } |
OLD | NEW |