Index: pkg/analyzer/lib/src/task/dart.dart |
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart |
index 810e1097cdf7bb06ac5d71de235a3fa4434357a3..e8443f87e0a9e61b75b5d019f4b110562fc7ffd2 100644 |
--- a/pkg/analyzer/lib/src/task/dart.dart |
+++ b/pkg/analyzer/lib/src/task/dart.dart |
@@ -1420,8 +1420,13 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask { |
// |
// Create and populate the library element. |
// |
+ AnalysisContext owningContext = context; |
+ if (context is InternalAnalysisContext) { |
+ InternalAnalysisContext internalContext = context; |
+ owningContext = internalContext.getContextFor(librarySource); |
+ } |
LibraryElementImpl libraryElement = |
- new LibraryElementImpl.forNode(context, libraryNameNode); |
+ new LibraryElementImpl.forNode(owningContext, libraryNameNode); |
libraryElement.definingCompilationUnit = definingCompilationUnitElement; |
libraryElement.entryPoint = entryPoint; |
libraryElement.parts = sourcedCompilationUnits; |