@@ -127,7 +127,7 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
127
127
_flowAnalysis;
128
128
129
129
/// If we are visiting a function body or initializer, assigned variable
130
- /// information used in flow analysis. Otherwise `null` .
130
+ /// information used in flow analysis. Otherwise `null` .
131
131
AssignedVariables <AstNode , PromotableElement > _assignedVariables;
132
132
133
133
/// The [DecoratedType] of the innermost function or method being visited, or
@@ -281,6 +281,32 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
281
281
}
282
282
}
283
283
284
+ @override
285
+ // TODO(srawlins): Theoretically, edges should be connected between arguments
286
+ // and parameters, as in an instance creation. It is quite rare though, to
287
+ // declare a class and use it as an annotation in the same package.
288
+ DecoratedType visitAnnotation (Annotation node) {
289
+ var previousFlowAnalysis = _flowAnalysis;
290
+ var previousAssignedVariables = _assignedVariables;
291
+ if (_flowAnalysis == null ) {
292
+ _assignedVariables = AssignedVariables ();
293
+ _flowAnalysis = FlowAnalysis <AstNode , Statement , Expression ,
294
+ PromotableElement , DecoratedType >(
295
+ DecoratedTypeOperations (_typeSystem, _variables, _graph),
296
+ _assignedVariables);
297
+ }
298
+ try {
299
+ _dispatch (node.name);
300
+ _dispatch (node.constructorName);
301
+ _dispatchList (node.arguments? .arguments);
302
+ } finally {
303
+ _flowAnalysis = previousFlowAnalysis;
304
+ _assignedVariables = previousAssignedVariables;
305
+ }
306
+ annotationVisited (node);
307
+ return null ;
308
+ }
309
+
284
310
@override
285
311
DecoratedType visitAsExpression (AsExpression node) {
286
312
if (BestPracticesVerifier .isUnnecessaryCast (
0 commit comments