mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 10:33:28 +00:00
Update _ContextTypeVisitor to support ConstructorName / ConstructorReference.
We need it to trigger constructor reference suggestions. Change-Id: I2a04520c85393b25f6db7fdd1e478aad81398a96 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216762 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
7e717e3ff7
commit
b6349445df
|
@ -651,6 +651,16 @@ class _ContextTypeVisitor extends SimpleAstVisitor<DartType> {
|
|||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
DartType? visitConstructorName(ConstructorName node) {
|
||||
return _visitParent(node);
|
||||
}
|
||||
|
||||
@override
|
||||
DartType? visitConstructorReference(ConstructorReference node) {
|
||||
return _visitParent(node);
|
||||
}
|
||||
|
||||
@override
|
||||
DartType? visitDefaultFormalParameter(DefaultFormalParameter node) {
|
||||
var separator = node.separator;
|
||||
|
|
|
@ -438,6 +438,30 @@ class C {
|
|||
''', 'num');
|
||||
}
|
||||
|
||||
Future<void> test_className_period() async {
|
||||
await assertContextType('''
|
||||
int x = List.^;
|
||||
''', 'int');
|
||||
}
|
||||
|
||||
Future<void> test_className_period_identifier() async {
|
||||
await assertContextType('''
|
||||
int x = List.^;
|
||||
''', 'int');
|
||||
}
|
||||
|
||||
Future<void> test_className_typeArguments_period() async {
|
||||
await assertContextType('''
|
||||
int x = List<double>.^;
|
||||
''', 'int');
|
||||
}
|
||||
|
||||
Future<void> test_className_typeArguments_period_identifier() async {
|
||||
await assertContextType('''
|
||||
int x = List<double>.foo^;
|
||||
''', 'int');
|
||||
}
|
||||
|
||||
Future<void> test_fieldDeclaration_int() async {
|
||||
await assertContextType('''
|
||||
class Foo {
|
||||
|
|
Loading…
Reference in a new issue