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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 958373003: Don't remove indexing operations on potential source changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index fedfe2289b42c45fe54eefad7a2f2d4fba6f4e03..aaabbe391fa82d722da91a4b77617bff45e416a6 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1853,36 +1853,48 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
@override
- CompilationUnit ensureAnyResolvedDartUnit(Source source) {
- SourceEntry sourceEntry = _cache.get(source);
+ List<CompilationUnit> ensureResolvedDartUnits(Source unitSource) {
Brian Wilkerson 2015/02/27 21:56:21 I might be misreading this code, but... It looks
scheglov 2015/02/28 01:34:35 We don't rerun this method. We ask it only only -
+ SourceEntry sourceEntry = _cache.get(unitSource);
if (sourceEntry is! DartEntry) {
return null;
}
DartEntry dartEntry = sourceEntry;
- // Check if there is a resolved unit.
- CompilationUnit unit = dartEntry.anyResolvedCompilationUnit;
- if (unit != null) {
- return unit;
+ // Check every library.
+ List<CompilationUnit> units = <CompilationUnit>[];
+ List<Source> containingLibraries = dartEntry.containingLibraries;
+ for (Source librarySource in containingLibraries) {
+ CompilationUnit unit =
+ dartEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource);
+ if (unit == null) {
+ units = null;
+ break;
+ }
+ units.add(unit);
}
// Invalidate the flushed RESOLVED_UNIT to force it eventually.
- bool shouldBeScheduled = false;
- List<Source> librariesContaining = dartEntry.containingLibraries;
- for (Source librarySource in librariesContaining) {
- if (dartEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) ==
- CacheState.FLUSHED) {
- dartEntry.setStateInLibrary(
+ if (units == null) {
+ bool shouldBeScheduled = false;
+ for (Source librarySource in containingLibraries) {
+ if (dartEntry.getStateInLibrary(
DartEntry.RESOLVED_UNIT,
- librarySource,
- CacheState.INVALID);
- shouldBeScheduled = true;
+ librarySource) ==
+ CacheState.FLUSHED) {
+ dartEntry.setStateInLibrary(
+ DartEntry.RESOLVED_UNIT,
+ librarySource,
+ CacheState.INVALID);
+ shouldBeScheduled = true;
+ }
}
+ if (shouldBeScheduled) {
+ _workManager.add(unitSource, SourcePriority.UNKNOWN);
+ }
+ // We cannot provide a resolved unit right now,
Paul Berry 2015/02/27 22:05:00 s/a resolved unit/resolved units/
scheglov 2015/02/28 01:34:35 Done.
+ // but the future analysis will.
+ return null;
}
- if (shouldBeScheduled) {
- _workManager.add(source, SourcePriority.UNKNOWN);
- }
- // We cannot provide a resolved unit right now,
- // but the future analysis will.
- return null;
+ // done
+ return units;
}
@override
@@ -9808,11 +9820,11 @@ abstract class InternalAnalysisContext implements AnalysisContext {
CompilationUnit computeResolvableCompilationUnit(Source source);
/**
- * Return any resolved [CompilationUnit] for the given [source] if not
- * flushed, otherwise return `null` and ensures that the [CompilationUnit]
+ * Return all the resolved [CompilationUnit]s for the given [source] if not
+ * flushed, otherwise return `null` and ensures that the [CompilationUnit]s
* will be eventually returned to the client from [performAnalysisTask].
*/
- CompilationUnit ensureAnyResolvedDartUnit(Source source);
+ List<CompilationUnit> ensureResolvedDartUnits(Source source);
/**
* Return context that owns the given source.

Powered by Google App Engine
This is Rietveld 408576698