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

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

Issue 2508223004: Fix for Import/ExportDirective annotations while applying resynthesized element model. (Closed)
Patch Set: Created 4 years, 1 month 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/declaration_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/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;
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/declaration_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698