[DAS] Fixes import prefix occurrences on constructor invocation

Fixes: https://github.com/dart-lang/sdk/issues/61803
Change-Id: I313064a26e48f05c6c1408c24911dc77f8b9fad8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457220
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
FMorschel
2025-10-24 09:52:41 -07:00
committed by Commit Queue
parent 4d045c9f82
commit c54692d00f
3 changed files with 6 additions and 2 deletions
@@ -132,6 +132,8 @@ class DartUnitOccurrencesComputerVisitor extends GeneralizingAstVisitor<void> {
if (element != null) {
_addOccurrence(element, node.type.name);
}
// Still visit the import prefix if there is one.
node.type.importPrefix?.accept(this);
return; // skip visitNamedType.
}
@@ -637,12 +637,13 @@ class A {
void m() {
/*[1*/p/*1]*/.foo();
print(/*[2*/p/*2]*/.a);
/*[3*/p/*3]*/.A();
}
}
void foo() {}
/*[3*/p/*3]*/.A? a;
/*[4*/p/*4]*/.A? a;
''');
}
@@ -370,12 +370,13 @@ class A {
void m() {
/*[1*/p/*1]*/.foo();
print(/*[2*/p/*2]*/.a);
/*[3*/p/*3]*/.A();
}
}
void foo() {}
/*[3*/p/*3]*/.A? a;
/*[4*/p/*4]*/.A? a;
''');
Future<void> test_prefixed() => _testMarkedContent('''