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

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

Issue 2829253002: Add support for external summaries bundle in AnalysisDriver. (Closed)
Patch Set: Fixes for review comments. Created 3 years, 8 months 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/library_context.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_context.dart b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
index f14cde27a64211301cc16399f1e389b667f86208..4d6641b8d9480125b3143e4990f07b7000e8d655 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
@@ -10,7 +10,6 @@ import 'package:analyzer/src/context/context.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/dart/analysis/file_state.dart';
-import 'package:analyzer/src/dart/analysis/file_tracker.dart';
import 'package:analyzer/src/generated/engine.dart'
show AnalysisContext, AnalysisEngine, AnalysisOptions;
import 'package:analyzer/src/generated/source.dart';
@@ -47,11 +46,16 @@ class LibraryContext {
AnalysisOptions options,
DeclaredVariables declaredVariables,
SourceFactory sourceFactory,
- FileTracker fileTracker) {
+ SummaryDataStore externalSummaries,
+ FileSystemState fsState) {
return logger.run('Create library context', () {
Map<String, FileState> libraries = <String, FileState>{};
SummaryDataStore store = new SummaryDataStore(const <String>[]);
+ if (externalSummaries != null) {
+ store.addStore(externalSummaries);
+ }
+
if (sdkBundle != null) {
store.addBundle(null, sdkBundle);
}
@@ -63,6 +67,10 @@ class LibraryContext {
return;
}
+ if (library.isInExternalSummaries) {
+ return;
+ }
+
libraries[library.uriStr] = library;
// Append the defining unit.
@@ -123,7 +131,7 @@ class LibraryContext {
});
var analysisContext = _createAnalysisContext(
- options, declaredVariables, sourceFactory, fileTracker, store);
+ options, declaredVariables, sourceFactory, fsState, store);
return new LibraryContext._(store, analysisContext);
});
@@ -165,7 +173,7 @@ class LibraryContext {
AnalysisOptions _analysisOptions,
DeclaredVariables declaredVariables,
SourceFactory _sourceFactory,
- FileTracker fileTracker,
+ FileSystemState fileSystemState,
SummaryDataStore store) {
AnalysisContextImpl analysisContext =
AnalysisEngine.instance.createAnalysisContext();
@@ -173,7 +181,7 @@ class LibraryContext {
analysisContext.analysisOptions = _analysisOptions;
analysisContext.declaredVariables.addAll(declaredVariables);
analysisContext.sourceFactory = _sourceFactory.clone();
- analysisContext.contentCache = new _ContentCacheWrapper(fileTracker);
+ analysisContext.contentCache = new _ContentCacheWrapper(fileSystemState);
analysisContext.resultProvider =
new InputPackagesResultProvider(analysisContext, store);
return analysisContext;
@@ -195,9 +203,9 @@ class ResolutionResult {
* [ContentCache] wrapper around [FileContentOverlay].
*/
class _ContentCacheWrapper implements ContentCache {
- final FileTracker fileTracker;
+ final FileSystemState fsState;
- _ContentCacheWrapper(this.fileTracker);
+ _ContentCacheWrapper(this.fsState);
@override
void accept(ContentCacheVisitor visitor) {
@@ -214,6 +222,10 @@ class _ContentCacheWrapper implements ContentCache {
if (source.isInSystemLibrary) {
return true;
}
+ String uriStr = source.uri.toString();
+ if (fsState.externalSummaries.hasUnlinkedUnit(uriStr)) {
+ return true;
+ }
return _getFileForSource(source).exists;
}
@@ -232,6 +244,6 @@ class _ContentCacheWrapper implements ContentCache {
FileState _getFileForSource(Source source) {
String path = source.fullName;
- return fileTracker.fsState.getFileForPath(path);
+ return fsState.getFileForPath(path);
}
}
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart ('k') | pkg/analyzer/lib/src/summary/package_bundle_reader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698