* @return an entry containing the computed results
* @throws AnalysisException if the results could not be recorded
*/
protected DartEntry recordResolveDartLibraryTaskResults(ResolveDartLibraryTask task)
throws AnalysisException {
LibraryResolver 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.
//
Set<Library> 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 recordResolveDartLibraryTaskResults, 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 (Library library : resolvedLibraries) {
Source librarySource = library.getLibrarySource();
for (Source source : library.getCompilationUnitSources()) {
CompilationUnit unit = library.getAST(source);
AnalysisError[] errors = errorListener.getErrorsForSource(source);