skip directives during nnbd migration

Currently, the migration engine crashes when it visits the identifier
in the following directive:

   import "dart:core" as one;

This updates the migration engine to skip directives when looking
for expressions and type annotations to be migrated.

Change-Id: I079263b13e5f4c75fbfe22fa06993e7a5d4f9c16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106660
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This commit is contained in:
Dan Rubel 2019-06-19 16:22:25 +00:00 committed by commit-bot@chromium.org
parent a75ded625e
commit 0e9d971f85
2 changed files with 15 additions and 0 deletions

View file

@ -483,6 +483,12 @@ class GraphBuilder extends GeneralizingAstVisitor<DecoratedType> {
return expressionType;
}
@override
DecoratedType visitNamespaceDirective(NamespaceDirective node) {
// skip directives
return null;
}
@override
DecoratedType visitNode(AstNode node) {
if (listener != null) {

View file

@ -1435,6 +1435,15 @@ main() {
hard: true);
}
test_skipDirectives() async {
await analyze('''
import "dart:core" as one;
main() {}
''');
// No test expectations.
// Just verifying that the test passes
}
test_soft_edge_for_non_variable_reference() async {
// Edges originating in things other than variable references should be
// soft.