Skip to content

Commit

Permalink
NNBD migrator: Visit metadata on top-level functions
Browse files Browse the repository at this point in the history
Change-Id: I6825f03ca754e05a6a8a7d4a9d3c13d9baa5ddaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127400
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
  • Loading branch information
srawlins authored and commit-bot@chromium.org committed Dec 5, 2019
1 parent eba38af commit 7ac3f3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/nnbd_migration/lib/src/edge_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>

@override
DecoratedType visitFunctionDeclaration(FunctionDeclaration node) {
node.metadata.accept(this);
if (_flowAnalysis != null) {
// This is a local function.
node.functionExpression.accept(this);
Expand Down
9 changes: 9 additions & 0 deletions pkg/nnbd_migration/test/edge_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2077,6 +2077,15 @@ bar() {
expect(type.returnType, isNotNull);
}

test_function_metadata() async {
await analyze('''
@deprecated
void f() {}
''');
// No assertions needed; the AnnotationTracker mixin verifies that the
// metadata was visited.
}

test_functionDeclaration_expression_body() async {
await analyze('''
int/*1*/ f(int/*2*/ i) => i/*3*/;
Expand Down

0 comments on commit 7ac3f3e

Please sign in to comment.