mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:27:39 +00:00
Support completion in enum constant argument list.
Change-Id: Id483d6ea3715e567f1d2cc9a2051f615b750a8a9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232684 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
582bf2f230
commit
ea4f04f56d
|
@ -738,6 +738,16 @@ void f() {}
|
|||
''');
|
||||
await computeAndCheck();
|
||||
|
||||
// Enum constant.
|
||||
addTestSource2('''
|
||||
$languageVersionLine
|
||||
enum E {
|
||||
v$arguments;
|
||||
const E$parameters;
|
||||
}
|
||||
''');
|
||||
await computeAndCheck();
|
||||
|
||||
// Function expression invocation.
|
||||
addTestSource2('''
|
||||
$languageVersionLine
|
||||
|
|
|
@ -291,6 +291,12 @@ class CompletionTarget {
|
|||
Element? executable;
|
||||
if (invocation is Annotation) {
|
||||
executable = invocation.element;
|
||||
} else if (invocation is EnumConstantArguments) {
|
||||
var enumConstant = invocation.parent;
|
||||
if (enumConstant is! EnumConstantDeclaration) {
|
||||
return null;
|
||||
}
|
||||
executable = enumConstant.constructorElement;
|
||||
} else if (invocation is InstanceCreationExpression) {
|
||||
executable = invocation.constructorName.staticElement;
|
||||
} else if (invocation is MethodInvocation) {
|
||||
|
|
|
@ -1376,6 +1376,8 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor<void> {
|
|||
var parent = node.parent;
|
||||
if (parent is Annotation) {
|
||||
return 'annotation';
|
||||
} else if (parent is EnumConstantArguments) {
|
||||
return 'enumConstantArguments';
|
||||
} else if (parent is ExtensionOverride) {
|
||||
return 'extensionOverride';
|
||||
} else if (parent is FunctionExpressionInvocation) {
|
||||
|
|
Loading…
Reference in a new issue