Skip to content

Commit

Permalink
Cache URIs resolution.
Browse files Browse the repository at this point in the history
TBR

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2440343002 .
  • Loading branch information
scheglov committed Oct 24, 2016
1 parent 64c776d commit 6ca7d24
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/analyzer/lib/src/dart/analysis/driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ 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].
*/
final _uriResolutionCache = <Uri, Map<String, Source>>{};

/**
* The current file state.
*
Expand Down Expand Up @@ -807,7 +813,9 @@ class _File {
* Return the [_File] for the [uri] referenced in this file.
*/
_File resolveUri(String uri) {
Source uriSource = driver._sourceFactory.resolveUri(source, uri);
Source uriSource = driver._uriResolutionCache
.putIfAbsent(this.uri, () => <String, Source>{})
.putIfAbsent(uri, () => driver._sourceFactory.resolveUri(source, uri));
return new _File(driver, uriSource);
}

Expand Down

0 comments on commit 6ca7d24

Please sign in to comment.