Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1390003002: Issue 24514. Set documentation range for LibraryElement. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
+ }
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698