mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:06:59 +00:00
Issue 50603. Fix element kind to EXTENSION in search.getElementDeclarations
Bug: https://github.com/dart-lang/sdk/issues/50603 Change-Id: I22b4d827bc9472544cf3c3aad3473de8050e2f6e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274085 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
efaad34a46
commit
356d15a3fc
|
@ -47,6 +47,8 @@ class SearchGetElementDeclarationsHandler extends LegacyHandler {
|
|||
return protocol.ElementKind.ENUM;
|
||||
case search.DeclarationKind.ENUM_CONSTANT:
|
||||
return protocol.ElementKind.ENUM_CONSTANT;
|
||||
case search.DeclarationKind.EXTENSION:
|
||||
return protocol.ElementKind.EXTENSION;
|
||||
case search.DeclarationKind.FIELD:
|
||||
return protocol.ElementKind.FIELD;
|
||||
case search.DeclarationKind.FUNCTION:
|
||||
|
|
|
@ -82,6 +82,37 @@ enum E {
|
|||
assertHas('c', ElementKind.ENUM_CONSTANT);
|
||||
}
|
||||
|
||||
Future<void> test_extension() async {
|
||||
addTestFile(r'''
|
||||
extension E on int {
|
||||
int get foo01 => 0;
|
||||
void set foo02(_) {}
|
||||
void foo03() {}
|
||||
}
|
||||
''');
|
||||
await _getDeclarations();
|
||||
|
||||
assertHas('E', ElementKind.EXTENSION);
|
||||
|
||||
{
|
||||
var declaration = assertHas('foo01', ElementKind.GETTER);
|
||||
expect(declaration.codeOffset, 23);
|
||||
expect(declaration.codeLength, 19);
|
||||
}
|
||||
|
||||
{
|
||||
var declaration = assertHas('foo02', ElementKind.SETTER);
|
||||
expect(declaration.codeOffset, 45);
|
||||
expect(declaration.codeLength, 20);
|
||||
}
|
||||
|
||||
{
|
||||
var declaration = assertHas('foo03', ElementKind.METHOD);
|
||||
expect(declaration.codeOffset, 68);
|
||||
expect(declaration.codeLength, 15);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> test_maxResults() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
class A {}
|
||||
|
|
Loading…
Reference in a new issue