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..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 && |