From 0065726e7798b3b18c5bfd26eb3a93ffa5a112f2 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Mon, 30 Sep 2024 15:45:08 +0000 Subject: [PATCH] Elements. Migrate JoinVariableDeclaration. Change-Id: If3290aaeecc8b698dc655755e3da5fe7dc3b26e9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387356 Reviewed-by: Samuel Rawlins Commit-Queue: Konstantin Shcheglov --- pkg/analysis_server/analyzer_use_new_elements.txt | 1 + .../services/correction/dart/join_variable_declaration.dart | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/analysis_server/analyzer_use_new_elements.txt b/pkg/analysis_server/analyzer_use_new_elements.txt index aa2fc8d9eadf..db99f76b777a 100644 --- a/pkg/analysis_server/analyzer_use_new_elements.txt +++ b/pkg/analysis_server/analyzer_use_new_elements.txt @@ -305,6 +305,7 @@ lib/src/services/correction/dart/insert_semicolon.dart lib/src/services/correction/dart/invert_if_statement.dart lib/src/services/correction/dart/join_if_with_inner.dart lib/src/services/correction/dart/join_if_with_outer.dart +lib/src/services/correction/dart/join_variable_declaration.dart lib/src/services/correction/dart/make_class_abstract.dart lib/src/services/correction/dart/make_conditional_on_debug_mode.dart lib/src/services/correction/dart/make_field_public.dart diff --git a/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart index 0e1f14a085a4..12454c350cf9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart @@ -82,7 +82,7 @@ class JoinVariableDeclaration extends ResolvedCorrectionProducer { // The declared variable must be the one that is assigned. // There must be no initializer. var declaredVariable = declaredVariables.single; - if (declaredVariable.declaredElement != left.staticElement || + if (declaredVariable.declaredElement2 != left.element || declaredVariable.initializer != null) { return; } @@ -144,7 +144,7 @@ class JoinVariableDeclaration extends ResolvedCorrectionProducer { } // The assignment should write into the declared variable. - if (assignment.writeElement != declaredVariable.declaredElement) { + if (assignment.writeElement2 != declaredVariable.declaredElement2) { return; }