Index: pkg/analyzer/lib/src/dart/analysis/driver.dart |
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
index 7d493d612f89a16d6e64bca07cd4048013e30528..ecf4de5e3f2a850e13266307fcf3c0b70868ace3 100644 |
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart |
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
@@ -592,9 +592,14 @@ class AnalysisDriver { |
AnalysisContext analysisContext = _createAnalysisContext(libraryContext); |
// Resynthesize the CompilationUnitElement in the context. |
- CompilationUnitElement unitElement = analysisContext.computeResult( |
- new LibrarySpecificUnit(libraryFile.source, file.source), |
- COMPILATION_UNIT_ELEMENT); |
+ CompilationUnitElement unitElement; |
+ try { |
+ unitElement = analysisContext.computeResult( |
+ new LibrarySpecificUnit(libraryFile.source, file.source), |
+ COMPILATION_UNIT_ELEMENT); |
+ } finally { |
+ analysisContext.dispose(); |
+ } |
// Return as IndexResult. |
return new IndexResult(unitElement, analysisResult._index); |