OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
8 | 8 |
9 import 'package:analyzer/context/context_root.dart'; | 9 import 'package:analyzer/context/context_root.dart'; |
10 import 'package:analyzer/context/declared_variables.dart'; | 10 import 'package:analyzer/context/declared_variables.dart'; |
(...skipping 27 matching lines...) Expand all Loading... |
38 import 'package:analyzer/src/lint/registry.dart' as linter; | 38 import 'package:analyzer/src/lint/registry.dart' as linter; |
39 import 'package:analyzer/src/summary/format.dart'; | 39 import 'package:analyzer/src/summary/format.dart'; |
40 import 'package:analyzer/src/summary/idl.dart'; | 40 import 'package:analyzer/src/summary/idl.dart'; |
41 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 41 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
42 import 'package:front_end/src/base/api_signature.dart'; | 42 import 'package:front_end/src/base/api_signature.dart'; |
43 import 'package:front_end/src/base/performace_logger.dart'; | 43 import 'package:front_end/src/base/performace_logger.dart'; |
44 import 'package:front_end/src/byte_store/byte_store.dart'; | 44 import 'package:front_end/src/byte_store/byte_store.dart'; |
45 import 'package:meta/meta.dart'; | 45 import 'package:meta/meta.dart'; |
46 | 46 |
47 /** | 47 /** |
| 48 * TODO(scheglov) We could use generalized Function in [AnalysisDriverTestView], |
| 49 * but this breaks `AnalysisContext` and code generation. So, for now let's |
| 50 * work around them, and rewrite generators to [AnalysisDriver]. |
| 51 */ |
| 52 typedef Future<Null> WorkToWaitAfterComputingResult(String path); |
| 53 |
| 54 /** |
48 * This class computes [AnalysisResult]s for Dart files. | 55 * This class computes [AnalysisResult]s for Dart files. |
49 * | 56 * |
50 * Let the set of "explicitly analyzed files" denote the set of paths that have | 57 * Let the set of "explicitly analyzed files" denote the set of paths that have |
51 * been passed to [addFile] but not subsequently passed to [removeFile]. Let | 58 * been passed to [addFile] but not subsequently passed to [removeFile]. Let |
52 * the "current analysis results" denote the map from the set of explicitly | 59 * the "current analysis results" denote the map from the set of explicitly |
53 * analyzed files to the most recent [AnalysisResult] delivered to [results] | 60 * analyzed files to the most recent [AnalysisResult] delivered to [results] |
54 * for each file. Let the "current file state" represent a map from file path | 61 * for each file. Let the "current file state" represent a map from file path |
55 * to the file contents most recently read from that file, or fetched from the | 62 * to the file contents most recently read from that file, or fetched from the |
56 * content cache (considering all possible possible file paths, regardless of | 63 * content cache (considering all possible possible file paths, regardless of |
57 * whether they're in the set of explicitly analyzed files). Let the | 64 * whether they're in the set of explicitly analyzed files). Let the |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 } | 1675 } |
1669 | 1676 |
1670 @visibleForTesting | 1677 @visibleForTesting |
1671 class AnalysisDriverTestView { | 1678 class AnalysisDriverTestView { |
1672 final AnalysisDriver driver; | 1679 final AnalysisDriver driver; |
1673 | 1680 |
1674 int numOfCreatedLibraryContexts = 0; | 1681 int numOfCreatedLibraryContexts = 0; |
1675 | 1682 |
1676 int numOfAnalyzedLibraries = 0; | 1683 int numOfAnalyzedLibraries = 0; |
1677 | 1684 |
1678 Future<Null> Function(String path) workToWaitAfterComputingResult; | 1685 WorkToWaitAfterComputingResult workToWaitAfterComputingResult; |
1679 | 1686 |
1680 AnalysisDriverTestView(this.driver); | 1687 AnalysisDriverTestView(this.driver); |
1681 | 1688 |
1682 FileTracker get fileTracker => driver._fileTracker; | 1689 FileTracker get fileTracker => driver._fileTracker; |
1683 | 1690 |
1684 Map<String, AnalysisResult> get priorityResults => driver._priorityResults; | 1691 Map<String, AnalysisResult> get priorityResults => driver._priorityResults; |
1685 | 1692 |
1686 Future<SummaryDataStore> getSummaryStore(String libraryPath) async { | 1693 Future<SummaryDataStore> getSummaryStore(String libraryPath) async { |
1687 FileState library = driver.fsState.getFileForPath(libraryPath); | 1694 FileState library = driver.fsState.getFileForPath(libraryPath); |
1688 LibraryContext libraryContext = await driver._createLibraryContext(library); | 1695 LibraryContext libraryContext = await driver._createLibraryContext(library); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 libraryDeclarations.add(new TopLevelDeclarationInSource( | 2114 libraryDeclarations.add(new TopLevelDeclarationInSource( |
2108 file.source, declaration, isExported)); | 2115 file.source, declaration, isExported)); |
2109 } | 2116 } |
2110 } | 2117 } |
2111 } | 2118 } |
2112 | 2119 |
2113 // We're not done yet. | 2120 // We're not done yet. |
2114 return false; | 2121 return false; |
2115 } | 2122 } |
2116 } | 2123 } |
OLD | NEW |