mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 20:41:45 +00:00
[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:
parent
d77ded508e
commit
dfe2463517
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue