* @param sources the set to which sources should be added
*/
private void getSourcesNeedingProcessing(Source source, SourceEntry sourceEntry,
boolean isPriority, boolean hintsEnabled, HashSet<Source> sources) {
if (sourceEntry instanceof DartEntry) {
DartEntry dartEntry = (DartEntry) sourceEntry;
CacheState scanErrorsState = dartEntry.getState(DartEntry.SCAN_ERRORS);
if (scanErrorsState == CacheState.INVALID
|| (isPriority && scanErrorsState == CacheState.FLUSHED)) {
sources.add(source);
return;
}
CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS);
if (parseErrorsState == CacheState.INVALID
|| (isPriority && parseErrorsState == CacheState.FLUSHED)) {
sources.add(source);
return;
}
if (isPriority) {
if (!dartEntry.hasResolvableCompilationUnit()) {
sources.add(source);
return;
}
}
for (Source librarySource : getLibrariesContaining(source)) {
SourceEntry libraryEntry = cache.get(librarySource);
if (libraryEntry instanceof DartEntry) {
CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT);
if (elementState == CacheState.INVALID
|| (isPriority && elementState == CacheState.FLUSHED)) {
sources.add(source);
return;
}
CacheState resolvedUnitState = dartEntry.getStateInLibrary(
DartEntry.RESOLVED_UNIT,
librarySource);
if (resolvedUnitState == CacheState.INVALID
|| (isPriority && resolvedUnitState == CacheState.FLUSHED)) {
LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT);
if (libraryElement != null) {
sources.add(source);
return;
}
}
if (generateSdkErrors || !source.isInSystemLibrary()) {
CacheState verificationErrorsState = dartEntry.getStateInLibrary(
DartEntry.VERIFICATION_ERRORS,
librarySource);
if (verificationErrorsState == CacheState.INVALID
|| (isPriority && verificationErrorsState == CacheState.FLUSHED)) {
LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT);
if (libraryElement != null) {
sources.add(source);
return;
}
}
if (hintsEnabled) {
CacheState hintsState = dartEntry.getStateInLibrary(DartEntry.HINTS, librarySource);
if (hintsState == CacheState.INVALID
|| (isPriority && hintsState == CacheState.FLUSHED)) {
LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT);
if (libraryElement != null) {
sources.add(source);