[S] Change in dart/sdk[main]: Suppport ForEachPartsWithPattern in NodeReplacer.

0 views
Skip to first unread message

Konstantin Shcheglov (Gerrit)

unread,
Feb 7, 2023, 5:12:18 PM2/7/23
to Brian Wilkerson, rev...@dartlang.org

Attention is currently required from: Brian Wilkerson.

Konstantin Shcheglov would like Brian Wilkerson to review this change.

View Change

Suppport ForEachPartsWithPattern in NodeReplacer.

Change-Id: I152f3c7b0500db9ad4ca633dd0f4491cea460f53
---
M pkg/analyzer/lib/src/dart/ast/utilities.dart
M pkg/analyzer/test/generated/utilities_test.dart
2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index 57a0bcd..8093d40 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -2514,6 +2514,16 @@
}

@override
+ bool? visitForEachPartsWithPattern(ForEachPartsWithPattern node) {
+ if (identical(node.iterable, _oldNode)) {
+ (node as ForEachPartsWithPatternImpl).iterable =
+ _newNode as ExpressionImpl;
+ return true;
+ }
+ return visitNode(node);
+ }
+
+ @override
bool visitForElement(ForElement node) {
if (identical(node.forLoopParts, _oldNode)) {
(node as ForElementImpl).forLoopParts = _newNode as ForLoopPartsImpl;
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index b81bfa4..729ea55 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -876,6 +876,22 @@
);
}

+ void test_forEachPartsWithPattern() {
+ var findNode = _parseStringToFindNode(r'''
+void f() {
+ for (var (a) in []) {}
+ for (var (b) in []) {}
+}
+''');
+ _assertReplacementForChildren<ForEachPartsWithPattern>(
+ destination: findNode.forEachPartsWithPattern('(a)'),
+ source: findNode.forEachPartsWithPattern('(b)'),
+ childAccessors: [
+ (node) => node.iterable,
+ ],
+ );
+ }
+
void test_forEachStatement_withIdentifier() {
var findNode = _parseStringToFindNode(r'''
void f(int a) {

To view, visit change 281465. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I152f3c7b0500db9ad4ca633dd0f4491cea460f53
Gerrit-Change-Number: 281465
Gerrit-PatchSet: 1
Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-MessageType: newchange

Konstantin Shcheglov (Gerrit)

unread,
Feb 7, 2023, 5:12:19 PM2/7/23
to rev...@dartlang.org, Brian Wilkerson, Commit Queue

Attention is currently required from: Brian Wilkerson.

View Change

    To view, visit change 281465. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sdk
    Gerrit-Branch: main
    Gerrit-Change-Id: I152f3c7b0500db9ad4ca633dd0f4491cea460f53
    Gerrit-Change-Number: 281465
    Gerrit-PatchSet: 1
    Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
    Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
    Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
    Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
    Gerrit-Comment-Date: Tue, 07 Feb 2023 22:12:14 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Brian Wilkerson (Gerrit)

    unread,
    Feb 7, 2023, 5:18:27 PM2/7/23
    to Konstantin Shcheglov, rev...@dartlang.org, Brian Wilkerson, Commit Queue

    Attention is currently required from: Konstantin Shcheglov.

    Patch set 1:Code-Review +1

    View Change

      To view, visit change 281465. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: sdk
      Gerrit-Branch: main
      Gerrit-Change-Id: I152f3c7b0500db9ad4ca633dd0f4491cea460f53
      Gerrit-Change-Number: 281465
      Gerrit-PatchSet: 1
      Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
      Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
      Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
      Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
      Gerrit-Comment-Date: Tue, 07 Feb 2023 22:18:23 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      Gerrit-MessageType: comment

      CBuild (Gerrit)

      unread,
      Feb 7, 2023, 5:48:45 PM2/7/23
      to Konstantin Shcheglov, rev...@dartlang.org, Brian Wilkerson, Commit Queue

      Attention is currently required from: Konstantin Shcheglov.

      go/dart-cbuild result: SUCCESS

      Details: https://goto.google.com/dart-cbuild/find/7eb090154a69a7f800843e81b0f171d93524904b

      View Change

        To view, visit change 281465. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: sdk
        Gerrit-Branch: main
        Gerrit-Change-Id: I152f3c7b0500db9ad4ca633dd0f4491cea460f53
        Gerrit-Change-Number: 281465
        Gerrit-PatchSet: 1
        Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
        Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
        Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
        Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
        Gerrit-Comment-Date: Tue, 07 Feb 2023 22:48:38 +0000

        Konstantin Shcheglov (Gerrit)

        unread,
        Feb 7, 2023, 5:58:38 PM2/7/23
        to rev...@dartlang.org, CBuild, Brian Wilkerson, Commit Queue

        Attention is currently required from: Konstantin Shcheglov.

        Patch set 1:Commit-Queue +2

        View Change

          To view, visit change 281465. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-Project: sdk
          Gerrit-Branch: main
          Gerrit-Change-Id: I152f3c7b0500db9ad4ca633dd0f4491cea460f53
          Gerrit-Change-Number: 281465
          Gerrit-PatchSet: 1
          Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
          Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
          Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
          Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
          Gerrit-Comment-Date: Tue, 07 Feb 2023 22:58:33 +0000

          Commit Queue (Gerrit)

          unread,
          Feb 7, 2023, 5:58:53 PM2/7/23
          to Konstantin Shcheglov, rev...@dartlang.org, CBuild, Brian Wilkerson

          Commit Queue submitted this change.

          View Change

          Approvals: Konstantin Shcheglov: Commit Brian Wilkerson: Looks good to me, approved
          Suppport ForEachPartsWithPattern in NodeReplacer.

          Change-Id: I152f3c7b0500db9ad4ca633dd0f4491cea460f53
          Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281465
          Reviewed-by: Brian Wilkerson <brianwi...@google.com>
          Commit-Queue: Konstantin Shcheglov <sche...@google.com>

          ---
          M pkg/analyzer/lib/src/dart/ast/utilities.dart
          M pkg/analyzer/test/generated/utilities_test.dart
          2 files changed, 38 insertions(+), 0 deletions(-)

          To view, visit change 281465. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-Project: sdk
          Gerrit-Branch: main
          Gerrit-Change-Id: I152f3c7b0500db9ad4ca633dd0f4491cea460f53
          Gerrit-Change-Number: 281465
          Gerrit-PatchSet: 2
          Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
          Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
          Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
          Gerrit-MessageType: merged

          CBuild (Gerrit)

          unread,
          Feb 7, 2023, 6:36:00 PM2/7/23
          to Konstantin Shcheglov, Commit Queue, rev...@dartlang.org, Brian Wilkerson

          go/dart-cbuild result: SUCCESS

          Details: https://goto.google.com/dart-cbuild/find/e86fe85aa4935474abcbde91bd2fa0c29b66b609

          View Change

            To view, visit change 281465. To unsubscribe, or for help writing mail filters, visit settings.

            Gerrit-Project: sdk
            Gerrit-Branch: main
            Gerrit-Change-Id: I152f3c7b0500db9ad4ca633dd0f4491cea460f53
            Gerrit-Change-Number: 281465
            Gerrit-PatchSet: 2
            Gerrit-Owner: Konstantin Shcheglov <sche...@google.com>
            Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
            Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
            Gerrit-Comment-Date: Tue, 07 Feb 2023 23:35:55 +0000
            Reply all
            Reply to author
            Forward
            0 new messages