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

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

Issue 818173003: Use all library units for hints during incremental resolution. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 c82d274d4c4c486e520af4279a6db3dca5a4cfac..5ea16a5351f0cd96dca4a4fc424cd07312006c88 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -5023,15 +5023,30 @@ class AnalysisContextImpl implements InternalAnalysisContext {
if (dartEntry == null) {
return false;
}
- // prepare the (only) library
+ // prepare the (only) library source
List<Source> librarySources = getLibrariesContaining(unitSource);
if (librarySources.length != 1) {
return false;
}
- // prepare the existing unit
Source librarySource = librarySources[0];
- CompilationUnit oldUnit =
- getResolvedCompilationUnit2(unitSource, librarySource);
+ // prepare the library element
+ LibraryElement libraryElement = getLibraryElement(librarySource);
+ 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];
if (oldUnit == null) {
return false;
}
@@ -5039,10 +5054,11 @@ class AnalysisContextImpl implements InternalAnalysisContext {
Stopwatch perfCounter = new Stopwatch()..start();
PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver(
typeProvider,
+ units,
unitSource,
dartEntry,
analysisOptions.incrementalApi);
- bool success = resolver.resolve(oldUnit, newCode);
+ bool success = resolver.resolve(newCode);
AnalysisEngine.instance.instrumentationService.logPerformance(
AnalysisPerformanceKind.INCREMENTAL,
perfCounter,
@@ -5058,14 +5074,14 @@ class AnalysisContextImpl implements InternalAnalysisContext {
incrementalResolutionValidation_lastUnit = oldUnit;
return false;
}
- // prepare notice
- ChangeNoticeImpl notice = _getNotice(unitSource);
- notice.compilationUnit = oldUnit;
- // apply updated errors
- {
- LineInfo lineInfo = getLineInfo(unitSource);
+ // prepare notices
+ units.forEach((Source source, CompilationUnit unit) {
+ DartEntry dartEntry = _cache.get(source);
+ LineInfo lineInfo = getLineInfo(source);
+ ChangeNoticeImpl notice = _getNotice(source);
+ notice.compilationUnit = unit;
notice.setErrors(dartEntry.allErrors, lineInfo);
- }
+ });
// OK
return true;
}
@@ -9540,6 +9556,7 @@ 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