Skip to content

Commit 66a22bb

Browse files
committed
supports MatchOr, MatchSequence, MatchStar
1 parent 55169bb commit 66a22bb

File tree

2 files changed

+769
-237
lines changed

2 files changed

+769
-237
lines changed

rope/refactor/patchedast.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,10 @@ def _Match(self, node):
785785
children.extend(node.cases)
786786
self._handle(node, children)
787787

788+
def _MatchOr(self, node):
789+
children = [*self._child_nodes(node.patterns, "|")]
790+
self._handle(node, children)
791+
788792
def _match_case(self, node):
789793
children = ["case", node.pattern]
790794
if node.guard:
@@ -793,6 +797,13 @@ def _match_case(self, node):
793797
children.extend(node.body)
794798
self._handle(node, children)
795799

800+
def _MatchSequence(self, node):
801+
children = ["[", *self._child_nodes(node.patterns, ","), "]"]
802+
self._handle(node, children)
803+
804+
def _MatchStar(self, node):
805+
self._handle(node, ["*_"])
806+
796807
def _MatchAs(self, node):
797808
if node.pattern:
798809
children = [node.pattern, "as", node.name]

0 commit comments

Comments
 (0)