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

Unified Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 1620203006: set LibraryElement documentation to docs of first directive in CU (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: remove unused var Created 4 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56fc384bb758da3271b428e29ba36ea35e3b5642..738bc4c485dc07b2197e421e24b4916d6c06f9a5 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -1398,7 +1398,6 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask {
//
// Update "part" directives.
//
- LibraryDirective libraryDirective = null;
LibraryIdentifier libraryNameNode = null;
String partsLibraryName = _UNKNOWN_LIBRARY_NAME;
bool hasPartDirective = false;
@@ -1409,11 +1408,8 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask {
<CompilationUnitElementImpl>[];
for (Directive directive in definingCompilationUnit.directives) {
if (directive is LibraryDirective) {
- if (libraryDirective == null) {
- libraryDirective = directive;
- libraryNameNode = directive.name;
- directivesToResolve.add(directive);
- }
+ libraryNameNode = directive.name;
+ directivesToResolve.add(directive);
} else if (directive is PartDirective) {
PartDirective partDirective = directive;
StringLiteral partUri = partDirective.uri;
@@ -1492,9 +1488,12 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask {
directive.element = libraryElement;
}
BuildLibraryElementUtils.patchTopLevelAccessors(libraryElement);
- if (libraryDirective != null) {
- _setDoc(libraryElement, libraryDirective);
+ // set the library documentation to the docs associated with the first
+ // directive in the compilation unit.
+ if (definingCompilationUnit.directives.isNotEmpty) {
+ _setDoc(libraryElement, definingCompilationUnit.directives.first);
}
+
//
// Record outputs.
//
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698