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

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

Issue 901713004: Invalidate hints instead of computing them in the incremental resolver. (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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/incremental_resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 743353abe9b5ce9bf7f0ba90d746fa6b900bbc05..8bfae7150de40c98c42728d28e01c6733de36cc5 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -2253,6 +2253,24 @@ class AnalysisContextImpl implements InternalAnalysisContext {
return changed;
}
+ /**
+ * Invalidates hints in the given [librarySource].
+ */
+ void invalidateLibraryHints(Source librarySource) {
Brian Wilkerson 2015/02/05 21:55:59 This needs to iterate over all of the parts in the
scheglov 2015/02/05 22:06:27 Done.
+ SourceEntry sourceEntry = _cache.get(librarySource);
+ if (sourceEntry is! DartEntry) {
+ return;
+ }
+ DartEntry dartEntry = sourceEntry;
+ if (dartEntry.getStateInLibrary(DartEntry.HINTS, librarySource) ==
+ CacheState.VALID) {
+ dartEntry.setStateInLibrary(
+ DartEntry.HINTS,
+ librarySource,
+ CacheState.INVALID);
+ }
+ }
+
@override
bool isClientLibrary(Source librarySource) {
SourceEntry sourceEntry = _getReadableSourceEntry(librarySource);
@@ -5070,19 +5088,9 @@ class AnalysisContextImpl implements InternalAnalysisContext {
if (libraryElement == null) {
return false;
}
- // prepare the existing library units
- Map<Source, CompilationUnit> units = <Source, CompilationUnit>{};
- for (CompilationUnitElement unitElement in libraryElement.units) {
- Source unitSource = unitElement.source;
- CompilationUnit unit =
- getResolvedCompilationUnit2(unitSource, librarySource);
- if (unit == null) {
- return false;
- }
- units[unitSource] = unit;
- }
// prepare the existing unit
- CompilationUnit oldUnit = units[unitSource];
+ CompilationUnit oldUnit =
+ getResolvedCompilationUnit2(unitSource, librarySource);
if (oldUnit == null) {
return false;
}
@@ -5090,9 +5098,9 @@ class AnalysisContextImpl implements InternalAnalysisContext {
Stopwatch perfCounter = new Stopwatch()..start();
PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver(
typeProvider,
- units,
unitSource,
dartEntry,
+ oldUnit,
analysisOptions.incrementalApi);
bool success = resolver.resolve(newCode);
AnalysisEngine.instance.instrumentationService.logPerformance(
@@ -5110,14 +5118,13 @@ class AnalysisContextImpl implements InternalAnalysisContext {
incrementalResolutionValidation_lastUnit = oldUnit;
return false;
}
- // prepare notices
- units.forEach((Source source, CompilationUnit unit) {
- DartEntry dartEntry = _cache.get(source);
- LineInfo lineInfo = getLineInfo(source);
- ChangeNoticeImpl notice = _getNotice(source);
- notice.resolvedDartUnit = unit;
+ // prepare notice
+ {
+ LineInfo lineInfo = getLineInfo(unitSource);
+ ChangeNoticeImpl notice = _getNotice(unitSource);
+ notice.resolvedDartUnit = oldUnit;
notice.setErrors(dartEntry.allErrors, lineInfo);
- });
+ }
// OK
return true;
}
@@ -9640,7 +9647,6 @@ class IncrementalAnalysisTask extends AnalysisTask {
LibraryElement library = element.library;
if (library != null) {
IncrementalResolver resolver = new IncrementalResolver(
- <Source, CompilationUnit>{},
element,
cache.offset,
cache.oldLength,
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/incremental_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698