mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Ignore not ClassDeclaration target of an unknown method invocation.
R=brianwilkerson@google.com BUG= Review URL: https://codereview.chromium.org/1764743002 .
This commit is contained in:
parent
7c2c02d6a6
commit
adcf43968f
2 changed files with 17 additions and 3 deletions
|
@ -1990,13 +1990,17 @@ class FixProcessor {
|
|||
}
|
||||
ClassElement targetClassElement = targetType.element as ClassElement;
|
||||
targetElement = targetClassElement;
|
||||
// may be static
|
||||
// prepare target ClassDeclaration
|
||||
AstNode targetTypeNode = getParsedClassElementNode(targetClassElement);
|
||||
if (targetTypeNode is! ClassDeclaration) {
|
||||
return;
|
||||
}
|
||||
ClassDeclaration targetClassNode = targetTypeNode;
|
||||
// maybe static
|
||||
if (target is Identifier) {
|
||||
staticModifier = target.bestElement.kind == ElementKind.CLASS;
|
||||
}
|
||||
// prepare insert offset
|
||||
ClassDeclaration targetClassNode =
|
||||
getParsedClassElementNode(targetClassElement);
|
||||
prefix = ' ';
|
||||
insertOffset = targetClassNode.end - 1;
|
||||
if (targetClassNode.members.isEmpty) {
|
||||
|
|
|
@ -4341,6 +4341,16 @@ main() {
|
|||
await assertNoFix(DartFixKind.CREATE_METHOD);
|
||||
}
|
||||
|
||||
test_undefinedMethod_create_BAD_targetIsEnum() async {
|
||||
resolveTestUnit('''
|
||||
enum MyEnum {A, B}
|
||||
main() {
|
||||
MyEnum.foo();
|
||||
}
|
||||
''');
|
||||
await assertNoFix(DartFixKind.CREATE_METHOD);
|
||||
}
|
||||
|
||||
test_undefinedMethod_create_generic_BAD_argumentType() async {
|
||||
resolveTestUnit('''
|
||||
class A<T> {
|
||||
|
|
Loading…
Reference in a new issue