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

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

Issue 1850813002: Issue dartdoc#1124. Get used elements from directive comments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/hint_code_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 48490141f235f045e2c72d3876bd718fd4be8067..edd3c876d2622c1ee62c5dd7b784d7da002dab5d 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -4082,17 +4082,17 @@ class GatherUsedImportedElementsVisitor extends RecursiveAstVisitor {
@override
void visitExportDirective(ExportDirective node) {
- _visitMetadata(node.metadata);
+ _visitDirective(node);
}
@override
void visitImportDirective(ImportDirective node) {
- _visitMetadata(node.metadata);
+ _visitDirective(node);
}
@override
void visitLibraryDirective(LibraryDirective node) {
- _visitMetadata(node.metadata);
+ _visitDirective(node);
}
@override
@@ -4116,6 +4116,14 @@ class GatherUsedImportedElementsVisitor extends RecursiveAstVisitor {
_visitIdentifier(node.staticElement, node.name);
}
+ /**
+ * Visit identifiers used by the given [directive].
+ */
+ void _visitDirective(Directive directive) {
+ directive.documentationComment?.accept(this);
+ directive.metadata.accept(this);
+ }
+
void _visitIdentifier(Element element, String name) {
if (element == null) {
return;
@@ -4150,20 +4158,6 @@ class GatherUsedImportedElementsVisitor extends RecursiveAstVisitor {
// Remember the element.
usedElements.elements.add(element);
}
-
- /**
- * Given some [NodeList] of [Annotation]s, ensure that the identifiers are visited by
- * this visitor. Specifically, this covers the cases where AST nodes don't have their identifiers
- * visited by this visitor, but still need their annotations visited.
- *
- * @param annotations the list of annotations to visit
- */
- void _visitMetadata(NodeList<Annotation> annotations) {
- int count = annotations.length;
- for (int i = 0; i < count; i++) {
- annotations[i].accept(this);
- }
- }
}
/**
@@ -4463,7 +4457,7 @@ class ImplicitLabelScope {
* While this class does not yet have support for an "Organize Imports" action, this logic built up
* in this class could be used for such an action in the future.
*/
-class ImportsVerifier /*extends RecursiveAstVisitor<Object>*/ {
+class ImportsVerifier {
/**
* A list of [ImportDirective]s that the current library imports, as identifiers are visited
* by this visitor and an import has been identified as being used by the library, the
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698