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

Unified Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1680403003: Incrementally update incompletely resolved units. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/context/context.dart
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index d0d131d7aefdd2ebaebffde91fd9e59ced2c876a..e931197755049bf8239ed618b04066f76a1352bb 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -1497,6 +1497,31 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
/**
+ * Return a [CompilationUnit] for the given library and unit sources, which
+ * can be incrementally resolved.
+ */
+ CompilationUnit _getIncrementallyResolvableUnit(
+ Source librarySource, Source unitSource) {
+ LibrarySpecificUnit target =
+ new LibrarySpecificUnit(librarySource, unitSource);
+ for (ResultDescriptor result in [
+ RESOLVED_UNIT,
+ RESOLVED_UNIT11,
+ RESOLVED_UNIT10,
+ RESOLVED_UNIT9,
+ RESOLVED_UNIT8,
+ RESOLVED_UNIT7,
+ RESOLVED_UNIT6
+ ]) {
+ CompilationUnit unit = getResult(target, result);
+ if (unit != null) {
+ return unit;
+ }
+ }
+ return null;
+ }
+
+ /**
* Return a list containing all of the sources known to this context that have
* the given [kind].
*/
@@ -1843,7 +1868,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
incrementalResolutionValidation_lastUnitSource = null;
incrementalResolutionValidation_lastLibrarySource = null;
incrementalResolutionValidation_lastUnit = null;
- // prepare the entry
+ // prepare the source entry
CacheEntry sourceEntry = _cache.get(unitSource);
if (sourceEntry == null) {
return false;
@@ -1854,19 +1879,15 @@ class AnalysisContextImpl implements InternalAnalysisContext {
return false;
}
Source librarySource = librarySources[0];
+ // prepare the unit entry
CacheEntry unitEntry =
_cache.get(new LibrarySpecificUnit(librarySource, unitSource));
if (unitEntry == null) {
return false;
}
- // prepare the library element
- LibraryElement libraryElement = getLibraryElement(librarySource);
- if (libraryElement == null) {
- return false;
- }
// prepare the existing unit
CompilationUnit oldUnit =
- getResolvedCompilationUnit2(unitSource, librarySource);
+ _getIncrementallyResolvableUnit(librarySource, unitSource);
if (oldUnit == null) {
return false;
}
« 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