Skip to content

Commit

Permalink
Elements. Migrate ConvertIntoBlockBody.
Browse files Browse the repository at this point in the history
Change-Id: I49ca47fbb38902d31dd0995f9a6cdb771aa61034
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386737
Reviewed-by: Samuel Rawlins <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
  • Loading branch information
scheglov authored and Commit Queue committed Sep 29, 2024
1 parent 6de3097 commit 3c43538
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions pkg/analysis_server/analyzer_use_new_elements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ lib/src/services/correction/dart/convert_flutter_child.dart
lib/src/services/correction/dart/convert_flutter_children.dart
lib/src/services/correction/dart/convert_for_each_to_for_loop.dart
lib/src/services/correction/dart/convert_into_async_body.dart
lib/src/services/correction/dart/convert_into_block_body.dart
lib/src/services/correction/dart/convert_into_getter.dart
lib/src/services/correction/dart/convert_into_is_not.dart
lib/src/services/correction/dart/convert_quotes.dart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:_fe_analyzer_shared/src/scanner/token.dart';
import 'package:analysis_server/src/services/correction/assist.dart';
import 'package:analysis_server_plugin/edit/dart/correction_producer.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/element2.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer_plugin/utilities/assist/assist.dart';
Expand Down Expand Up @@ -175,13 +175,13 @@ class ConvertIntoBlockBody extends ResolvedCorrectionProducer {
return [returnCode];
}

ExecutableElement? _getFunctionElement(AstNode? node) {
ExecutableElement2? _getFunctionElement(AstNode? node) {
if (node is MethodDeclaration) {
return node.declaredElement;
return node.declaredFragment?.element;
} else if (node is ConstructorDeclaration) {
return node.declaredElement;
return node.declaredFragment?.element;
} else if (node is FunctionExpression) {
return node.declaredElement;
return node.declaredFragment?.element ?? node.declaredElement2;
}
return null;
}
Expand Down

0 comments on commit 3c43538

Please sign in to comment.