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

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

Issue 2444993003: Apply tweaks to address other review comments. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/analysis/driver.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index fafc9ae64bba4b0611aca5677364b912f6f94c76..a2a750d12aa3916636b84c0132d1cafa88164c41 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -126,8 +126,10 @@ class AnalysisDriver {
final _filesToAnalyze = new LinkedHashSet<String>();
/**
- * The mapping of [Uri]s to the mapping of textual URIs to the [Source]
- * that correspond in the current [_sourceFactory].
+ * Cache of URI resolution. The outer map key is the absolute URI of the
+ * containing file. The inner map key is the URI text of a directive
+ * contained in that file. The inner map value is the [Source] object which
+ * that URI text resolves to.
*/
final _uriResolutionCache = <Uri, Map<String, Source>>{};
@@ -341,16 +343,9 @@ class AnalysisDriver {
// libraryContext.file.source, libraryContext.file.source);
// });
// Compute errors.
- List<AnalysisError> errors;
- try {
- errors = _logger.run('Compute errors', () {
- return analysisContext.computeErrors(file.source);
- });
- } catch (e, st) {
- // TODO(scheglov) why does it fail?
- // Caused by Bad state: Unmatched TypeParameterElementImpl T
- errors = [];
- }
+ List<AnalysisError> errors = _logger.run('Compute errors', () {
+ return analysisContext.computeErrors(file.source);
+ });
List<String> errorStrings = errors
.where((error) => error.errorCode is! TodoCode)
.map((error) => error.toString())
@@ -801,6 +796,8 @@ class _File {
* Return the [_File] for the [uri] referenced in this file.
*/
_File resolveUri(String uri) {
+ // TODO(scheglov) Consider removing this caching after implementing other
+ // optimizations, e.g. changeFile() optimization.
Source uriSource = driver._uriResolutionCache
.putIfAbsent(this.uri, () => <String, Source>{})
.putIfAbsent(uri, () => driver._sourceFactory.resolveUri(source, uri));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698