55import 'package:analysis_server/src/services/correction/fix.dart' ;
66import 'package:analysis_server_plugin/edit/dart/correction_producer.dart' ;
77import 'package:analyzer/dart/ast/ast.dart' ;
8- import 'package:analyzer/dart/element/element .dart' ;
8+ import 'package:analyzer/dart/element/element2 .dart' ;
99import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart' ;
1010import 'package:analyzer_plugin/utilities/fixes/fixes.dart' ;
1111import 'package:analyzer_plugin/utilities/range_factory.dart' ;
@@ -29,43 +29,43 @@ class ChangeToStaticAccess extends ResolvedCorrectionProducer {
2929 @override
3030 Future <void > compute (ChangeBuilder builder) async {
3131 Expression ? target;
32- Element ? invokedElement;
32+ Element2 ? invokedElement;
3333 var identifier = node;
3434 if (identifier is SimpleIdentifier ) {
3535 var parent = identifier.parent;
3636 if (parent is MethodInvocation ) {
3737 if (parent.methodName == identifier) {
3838 target = parent.target;
39- invokedElement = identifier.staticElement ;
39+ invokedElement = identifier.element ;
4040 }
4141 } else if (parent is PrefixedIdentifier ) {
4242 if (parent.identifier == identifier) {
4343 target = parent.prefix;
44- invokedElement = identifier.staticElement ;
44+ invokedElement = identifier.element ;
4545 }
4646 }
4747 }
48- if (target == null || invokedElement is ! ExecutableElement ) {
48+ if (target == null || invokedElement is ! ExecutableElement2 ) {
4949 return ;
5050 }
5151
5252 var target_final = target;
53- var declaringElement = invokedElement.enclosingElement3 ;
53+ var declaringElement = invokedElement.enclosingElement2 ;
5454
55- if (declaringElement is InterfaceElement ) {
55+ if (declaringElement is InterfaceElement2 ) {
5656 _className = declaringElement.name;
5757 await builder.addDartFileEdit (file, (builder) {
5858 builder.addReplacement (range.node (target_final), (builder) {
59- builder.writeReference (declaringElement);
59+ builder.writeReference2 (declaringElement);
6060 });
6161 });
62- } else if (declaringElement is ExtensionElement ) {
62+ } else if (declaringElement is ExtensionElement2 ) {
6363 var extensionName = declaringElement.name;
6464 if (extensionName != null ) {
6565 _className = extensionName;
6666 await builder.addDartFileEdit (file, (builder) {
6767 builder.addReplacement (range.node (target_final), (builder) {
68- builder.writeReference (declaringElement);
68+ builder.writeReference2 (declaringElement);
6969 });
7070 });
7171 }
0 commit comments