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

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

Issue 981283003: Change all sources associated with changed files (issue 22680) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 5 years, 9 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 | « pkg/analysis_server/test/context_manager_test.dart ('k') | pkg/analyzer/test/generated/engine_test.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 d90a771f9ff7da80044900e15b2be57c169ffb45..6fff47c5ecf0155e47668657d6f1d2fefb3ed81c 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -419,12 +419,6 @@ abstract class AnalysisContext {
set name(String name);
/**
- * Returns a type provider for this context or throws [AnalysisException] if
- * `dart:core` or `dart:async` cannot be resolved.
- */
- TypeProvider get typeProvider;
-
- /**
* The stream that is notified when sources have been added or removed,
* or the source's content has changed.
*/
@@ -457,6 +451,12 @@ abstract class AnalysisContext {
void set sourceFactory(SourceFactory factory);
/**
+ * Returns a type provider for this context or throws [AnalysisException] if
+ * `dart:core` or `dart:async` cannot be resolved.
+ */
+ TypeProvider get typeProvider;
+
+ /**
* Add the given listener to the list of objects that are to be notified when various analysis
* results are produced in this context.
*
@@ -787,6 +787,12 @@ abstract class AnalysisContext {
ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource);
/**
+ * Return a list of the sources being analyzed in this context whose full path
+ * is equal to the given [path].
+ */
+ List<Source> getSourcesWithFullName(String path);
+
+ /**
* Return `true` if the given source is known to be the defining compilation unit of a
* library that can be run on a client (references 'dart:html', either directly or indirectly).
*
@@ -1127,7 +1133,8 @@ class AnalysisContextImpl implements InternalAnalysisContext {
void set analysisOptions(AnalysisOptions options) {
bool needsRecompute = this._options.analyzeFunctionBodiesPredicate !=
options.analyzeFunctionBodiesPredicate ||
- this._options.generateImplicitErrors != options.generateImplicitErrors ||
+ this._options.generateImplicitErrors !=
+ options.generateImplicitErrors ||
this._options.generateSdkErrors != options.generateSdkErrors ||
this._options.dart2jsHint != options.dart2jsHint ||
(this._options.hint && !options.hint) ||
@@ -1153,7 +1160,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
this._options.analyzeFunctionBodiesPredicate =
options.analyzeFunctionBodiesPredicate;
- this._options.generateImplicitErrors = options.generateImplicitErrors;
+ this._options.generateImplicitErrors = options.generateImplicitErrors;
this._options.generateSdkErrors = options.generateSdkErrors;
this._options.dart2jsHint = options.dart2jsHint;
this._options.hint = options.hint;
@@ -2164,6 +2171,18 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
@override
+ List<Source> getSourcesWithFullName(String path) {
+ List<Source> sources = <Source>[];
+ MapIterator<Source, SourceEntry> iterator = _cache.iterator();
+ while (iterator.moveNext()) {
+ if (iterator.key.fullName == path) {
+ sources.add(iterator.key);
+ }
+ }
+ return sources;
+ }
+
+ @override
bool handleContentsChanged(
Source source, String originalContents, String newContents, bool notify) {
SourceEntry sourceEntry = _cache.get(source);
@@ -2625,20 +2644,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
/**
- * Return `true` if errors should be produced for the given [source]. The
- * [dartEntry] associated with the source is passed in for efficiency.
- */
- bool _shouldErrorsBeAnalyzed(Source source, DartEntry dartEntry) {
- if (source.isInSystemLibrary) {
- return _generateSdkErrors;
- } else if (!dartEntry.explicitlyAdded) {
- return _generateImplicitErrors;
- } else {
- return true;
- }
- }
-
- /**
* Visit all entries of the content cache.
*/
void visitContentCache(ContentCacheVisitor visitor) {
@@ -4329,6 +4334,28 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
}
+ /**
+ * Record the results produced by performing a [task] and return the cache
+ * entry associated with the results.
+ */
+ DartEntry _recordBuildUnitElementTask(BuildUnitElementTask task) {
+ Source source = task.source;
+ Source library = task.library;
+ DartEntry dartEntry = _cache.get(source);
+ CaughtException thrownException = task.exception;
+ if (thrownException != null) {
+ dartEntry.recordBuildElementErrorInLibrary(library, thrownException);
+ throw new AnalysisException('<rethrow>', thrownException);
+ }
+ dartEntry.setValueInLibrary(DartEntry.BUILT_UNIT, library, task.unit);
+ dartEntry.setValueInLibrary(
+ DartEntry.BUILT_ELEMENT, library, task.unitElement);
+ ChangeNoticeImpl notice = _getNotice(source);
+ LineInfo lineInfo = dartEntry.getValue(SourceEntry.LINE_INFO);
+ notice.setErrors(dartEntry.allErrors, lineInfo);
+ return dartEntry;
+ }
+
// /**
// * Notify all of the analysis listeners that the given source is no longer included in the set of
// * sources that are being analyzed.
@@ -4408,28 +4435,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
// }
/**
- * Record the results produced by performing a [task] and return the cache
- * entry associated with the results.
- */
- DartEntry _recordBuildUnitElementTask(BuildUnitElementTask task) {
- Source source = task.source;
- Source library = task.library;
- DartEntry dartEntry = _cache.get(source);
- CaughtException thrownException = task.exception;
- if (thrownException != null) {
- dartEntry.recordBuildElementErrorInLibrary(library, thrownException);
- throw new AnalysisException('<rethrow>', thrownException);
- }
- dartEntry.setValueInLibrary(DartEntry.BUILT_UNIT, library, task.unit);
- dartEntry.setValueInLibrary(
- DartEntry.BUILT_ELEMENT, library, task.unitElement);
- ChangeNoticeImpl notice = _getNotice(source);
- LineInfo lineInfo = dartEntry.getValue(SourceEntry.LINE_INFO);
- notice.setErrors(dartEntry.allErrors, lineInfo);
- return dartEntry;
- }
-
- /**
* Given a cache entry and a library element, record the library element and other information
* gleaned from the element in the cache entry.
*
@@ -4825,6 +4830,20 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
/**
+ * Return `true` if errors should be produced for the given [source]. The
+ * [dartEntry] associated with the source is passed in for efficiency.
+ */
+ bool _shouldErrorsBeAnalyzed(Source source, DartEntry dartEntry) {
+ if (source.isInSystemLibrary) {
+ return _generateSdkErrors;
+ } else if (!dartEntry.explicitlyAdded) {
+ return _generateImplicitErrors;
+ } else {
+ return true;
+ }
+ }
+
+ /**
* Create an entry for the newly added [source] and invalidate any sources
* that referenced the source before it existed.
*
@@ -7540,6 +7559,9 @@ class ChangeSet {
}
return true;
}
+
+ void changedAllSources(List<Source> sources) {
Paul Berry 2015/03/09 18:05:33 Was this added by mistake? It looks like it's not
Brian Wilkerson 2015/03/09 18:24:46 Yes. Thanks! I added it when looking at the ineff
+ }
}
/**
« no previous file with comments | « pkg/analysis_server/test/context_manager_test.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698