[analysis_server] Don't include prefixed type names in Outgoing Calls

Change-Id: Ic305706bf8fcb224c757b85379e69afa5ac8d102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Danny Tuppeny 2022-07-28 18:06:30 +00:00 committed by Commit Bot
parent d77ded508e
commit dfe2463517
2 changed files with 20 additions and 1 deletions

View file

@ -478,7 +478,11 @@ class _OutboundCallVisitor extends RecursiveAstVisitor<void> {
@override
void visitPrefixedIdentifier(PrefixedIdentifier node) {
collect(node.identifier);
// Don't collect prefixed identifiers that are just type names. We only
// want invocations and tear-offs.
if (node.parent is! NamedType) {
collect(node.identifier);
}
super.visitPrefixedIdentifier(node);
}

View file

@ -1459,6 +1459,21 @@ class A {
);
}
Future<void> test_prefixedTypes() async {
// Prefixed type names that are not tear-offs should never be included.
final contents = '''
// ignore_for_file: unused_local_variable
import 'dart:io' as io;
void ^f(io.File f) {
io.Directory? d;
}
''';
final calls = await findOutgoingCalls(contents);
expect(calls, isEmpty);
}
Future<void> test_setter() async {
final contents = '''
import 'other.dart';