Skip to content

Commit

Permalink
Updating comments for translate_match
Browse files Browse the repository at this point in the history
  • Loading branch information
prsabahrami committed May 24, 2024
1 parent 52ece52 commit 701b0d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion polarify/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,13 @@ def translate_match(
guard: ast.expr | None = None,
):
"""
TODO: Explain the purpose and goal of this method, it's quite complex
Translate a match_case statement into a regular AST expression.
translate_match takes a subject, a pattern and a guard.
patterns can be a MatchValue, MatchAs, MatchOr, or MatchSequence.
subjects can be a single expression (e.g x or (2 * x + 1)) or a list of expressions.
translate_match is called per each case in a match statement.
"""

if isinstance(pattern, ast.MatchValue):
equality_ast = ast.Compare(
left=subj,
Expand Down

0 comments on commit 701b0d0

Please sign in to comment.