The pattern as
| 23 | |
| 24 | |
| 25 | class AsPattern(Pattern): |
| 26 | """The pattern <pattern> as <name>""" |
| 27 | |
| 28 | # The python ast, and therefore also our ast merges capture, wildcard and as patterns into one |
| 29 | # for easier handling. |
| 30 | # If pattern is None this is a capture pattern. If name and pattern are both none this is a |
| 31 | # wildcard pattern. |
| 32 | # Only name being None should not happen but also won't break anything. |
| 33 | pattern: Pattern | None |
| 34 | name: NameExpr | None |
| 35 | |
| 36 | def __init__(self, pattern: Pattern | None, name: NameExpr | None) -> None: |
| 37 | super().__init__() |
| 38 | self.pattern = pattern |
| 39 | self.name = name |
| 40 | |
| 41 | def accept(self, visitor: PatternVisitor[T]) -> T: |
| 42 | return visitor.visit_as_pattern(self) |
| 43 | |
| 44 | |
| 45 | class OrPattern(Pattern): |
no outgoing calls
no test coverage detected
searching dependent graphs…