* @return an entry containing the computed results
* @throws AnalysisException if the results could not be recorded
*/
protected DartEntry recordResolveDartLibraryCycleTaskResults(ResolveDartLibraryCycleTask task)
throws AnalysisException {
LibraryResolver2 resolver = task.getLibraryResolver();
AnalysisException thrownException = task.getException();
DartEntry unitEntry = null;
Source unitSource = task.getUnitSource();
if (resolver != null) {
//
// The resolver should only be null if an exception was thrown before (or while) it was
// being created.
//
List<ResolvableLibrary> resolvedLibraries = resolver.getResolvedLibraries();
synchronized (cacheLock) {
if (resolvedLibraries == null) {
//
// The resolved libraries should only be null if an exception was thrown during resolution.
//
unitEntry = getReadableDartEntry(unitSource);
if (unitEntry == null) {
throw new AnalysisException("A Dart file became a non-Dart file: "
+ unitSource.getFullName());
}
DartEntryImpl dartCopy = unitEntry.getWritableCopy();
if (thrownException == null) {
dartCopy.recordResolutionError(new AnalysisException(
"In recordResolveDartLibraryCycleTaskResults, resolvedLibraries was null and there was no thrown exception"));
} else {
dartCopy.recordResolutionError(thrownException);
}
cache.put(unitSource, dartCopy);
cache.remove(unitSource);
if (thrownException != null) {
throw thrownException;
}
return dartCopy;
}
if (allModificationTimesMatch(resolvedLibraries)) {
Source htmlSource = getSourceFactory().forUri(DartSdk.DART_HTML);
RecordingErrorListener errorListener = resolver.getErrorListener();
for (ResolvableLibrary library : resolvedLibraries) {
Source librarySource = library.getLibrarySource();
for (Source source : library.getCompilationUnitSources()) {
CompilationUnit unit = library.getAST(source);
AnalysisError[] errors = errorListener.getErrorsForSource(source);