Index: pkg/analyzer/lib/src/generated/declaration_resolver.dart |
diff --git a/pkg/analyzer/lib/src/generated/declaration_resolver.dart b/pkg/analyzer/lib/src/generated/declaration_resolver.dart |
index 595acb9d9d9210de9ccb8dc6a859c71ef05cca49..90f3483a571db33a226f7747e664e4ad5d4ebd33 100644 |
--- a/pkg/analyzer/lib/src/generated/declaration_resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/declaration_resolver.dart |
@@ -154,8 +154,17 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> { |
@override |
Object visitExportDirective(ExportDirective node) { |
super.visitExportDirective(node); |
- _resolveAnnotations( |
- node, node.metadata, _enclosingUnit.getAnnotations(node.offset)); |
+ List<ElementAnnotation> annotations = |
+ _enclosingUnit.getAnnotations(node.offset); |
+ if (annotations.isEmpty && node.metadata.isNotEmpty) { |
+ int index = (node.parent as CompilationUnit) |
+ .directives |
+ .where((directive) => directive is ExportDirective) |
+ .toList() |
+ .indexOf(node); |
+ annotations = _walker.element.library.exports[index].metadata; |
+ } |
+ _resolveAnnotations(node, node.metadata, annotations); |
return null; |
} |
@@ -263,8 +272,17 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> { |
@override |
Object visitImportDirective(ImportDirective node) { |
super.visitImportDirective(node); |
- _resolveAnnotations( |
- node, node.metadata, _enclosingUnit.getAnnotations(node.offset)); |
+ List<ElementAnnotation> annotations = |
+ _enclosingUnit.getAnnotations(node.offset); |
+ if (annotations.isEmpty && node.metadata.isNotEmpty) { |
+ int index = (node.parent as CompilationUnit) |
+ .directives |
+ .where((directive) => directive is ImportDirective) |
+ .toList() |
+ .indexOf(node); |
+ annotations = _walker.element.library.imports[index].metadata; |
+ } |
+ _resolveAnnotations(node, node.metadata, annotations); |
return null; |
} |