Index: pkg/analyzer/lib/src/generated/resolver.dart |
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart |
index a5a99af45a3b921807118aae0db3e91464dbd553..0a7d60176326b5abf7a40c53b1e73daac0f35f57 100644 |
--- a/pkg/analyzer/lib/src/generated/resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/resolver.dart |
@@ -7088,6 +7088,7 @@ class LibraryElementBuilder { |
.buildCompilationUnit( |
librarySource, definingCompilationUnit, librarySource); |
NodeList<Directive> directives = definingCompilationUnit.directives; |
+ LibraryDirective libraryDirective = null; |
LibraryIdentifier libraryNameNode = null; |
bool hasPartDirective = false; |
FunctionElement entryPoint = |
@@ -7105,6 +7106,7 @@ class LibraryElementBuilder { |
// |
if (directive is LibraryDirective) { |
if (libraryNameNode == null) { |
+ libraryDirective = directive; |
libraryNameNode = directive.name; |
directivesToResolve.add(directive); |
} |
@@ -7163,6 +7165,7 @@ class LibraryElementBuilder { |
// |
LibraryElementImpl libraryElement = new LibraryElementImpl.forNode( |
_analysisContext.getContextFor(librarySource), libraryNameNode); |
+ _setDocRange(libraryElement, libraryDirective); |
libraryElement.definingCompilationUnit = definingCompilationUnitElement; |
if (entryPoint != null) { |
libraryElement.entryPoint = entryPoint; |
@@ -7194,6 +7197,7 @@ class LibraryElementBuilder { |
.buildCompilationUnit( |
librarySource, definingCompilationUnit, librarySource); |
NodeList<Directive> directives = definingCompilationUnit.directives; |
+ LibraryDirective libraryDirective = null; |
LibraryIdentifier libraryNameNode = null; |
bool hasPartDirective = false; |
FunctionElement entryPoint = |
@@ -7211,6 +7215,7 @@ class LibraryElementBuilder { |
// |
if (directive is LibraryDirective) { |
if (libraryNameNode == null) { |
+ libraryDirective = directive; |
libraryNameNode = directive.name; |
directivesToResolve.add(directive); |
} |
@@ -7271,6 +7276,7 @@ class LibraryElementBuilder { |
// |
LibraryElementImpl libraryElement = new LibraryElementImpl.forNode( |
_analysisContext.getContextFor(librarySource), libraryNameNode); |
+ _setDocRange(libraryElement, libraryDirective); |
libraryElement.definingCompilationUnit = definingCompilationUnitElement; |
if (entryPoint != null) { |
libraryElement.entryPoint = entryPoint; |
@@ -7374,6 +7380,17 @@ class LibraryElementBuilder { |
} |
} |
} |
+ |
+ /** |
+ * If the given [node] has a documentation comment, remember its range |
+ * into the given [element]. |
+ */ |
+ void _setDocRange(ElementImpl element, AnnotatedNode node) { |
+ Comment comment = node.documentationComment; |
+ if (comment != null && comment.isDocumentation) { |
+ element.setDocRange(comment.offset, comment.length); |
+ } |
+ } |
} |
/** |