MCPcopy
hub / github.com/python/mypy / visit_match_stmt

Method visit_match_stmt

mypy/partially_defined.py:411–427  ·  view source on GitHub ↗
(self, o: MatchStmt)

Source from the content-addressed store, hash-verified

409 self.tracker.end_branch_statement()
410
411 def visit_match_stmt(self, o: MatchStmt) -> None:
412 o.subject.accept(self)
413 self.tracker.start_branch_statement()
414 for i in range(len(o.patterns)):
415 pattern = o.patterns[i]
416 pattern.accept(self)
417 guard = o.guards[i]
418 if guard is not None:
419 guard.accept(self)
420 if not o.bodies[i].is_unreachable:
421 o.bodies[i].accept(self)
422 else:
423 self.tracker.skip_branch()
424 is_catchall = infer_pattern_value(pattern) == ALWAYS_TRUE
425 if not is_catchall:
426 self.tracker.next_branch()
427 self.tracker.end_branch_statement()
428
429 def visit_func_def(self, o: FuncDef) -> None:
430 self.process_definition(o.name)

Callers

nothing calls this directly

Calls 8

infer_pattern_valueFunction · 0.90
rangeClass · 0.85
lenFunction · 0.85
end_branch_statementMethod · 0.80
acceptMethod · 0.45
skip_branchMethod · 0.45
next_branchMethod · 0.45

Tested by

no test coverage detected