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

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

Issue 2520593003: Use AnalysisDriverUnlinkedUnit as a container for UnlinkedUnit and referenced names. (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
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | pkg/analyzer/lib/src/summary/format.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..409d79529a09431dff8d6f643242e624a2fab08b 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -11,6 +11,7 @@ import 'package:analyzer/error/listener.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/src/dart/analysis/referenced_names.dart';
import 'package:analyzer/src/dart/scanner/reader.dart';
import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/generated/engine.dart';
@@ -85,6 +86,7 @@ class FileState {
String _content;
String _contentHash;
LineInfo _lineInfo;
+ Set<String> _referencedNames;
UnlinkedUnit _unlinked;
List<int> _apiSignature;
@@ -160,6 +162,11 @@ class FileState {
List<FileState> get partedFiles => _partedFiles;
/**
+ * The external names referenced by the file.
+ */
+ Set<String> get referencedNames => _referencedNames;
+
+ /**
* Return the set of transitive files - the file itself and all of the
* directly or indirectly referenced files.
*/
@@ -253,14 +260,19 @@ class FileState {
CompilationUnit unit = parse(AnalysisErrorListener.NULL_LISTENER);
_fsState._logger.run('Create unlinked for $path', () {
UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit);
- bytes = unlinkedUnit.toBuffer();
+ List<String> referencedNames = computeReferencedNames(unit).toList();
+ bytes = new AnalysisDriverUnlinkedUnitBuilder(
+ unit: unlinkedUnit, referencedNames: referencedNames)
+ .toBuffer();
_fsState._byteStore.put(unlinkedKey, bytes);
});
}
}
// Read the unlinked bundle.
- _unlinked = new UnlinkedUnit.fromBuffer(bytes);
+ var driverUnlinkedUnit = new AnalysisDriverUnlinkedUnit.fromBuffer(bytes);
+ _referencedNames = new Set<String>.from(driverUnlinkedUnit.referencedNames);
Brian Wilkerson 2016/11/21 15:54:37 This is kind of ugly. Consider adding a getter to
scheglov 2016/11/21 17:04:54 We use flat buffers just as data. Any additional s
+ _unlinked = driverUnlinkedUnit.unit;
_lineInfo = new LineInfo(_unlinked.lineStarts);
List<int> newApiSignature = _unlinked.apiSignature;
bool apiSignatureChanged = _apiSignature != null &&
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | pkg/analyzer/lib/src/summary/format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698