Skip to content
Snippets Groups Projects
Verified Commit aa40cd9c authored by Rajmund Hruška's avatar Rajmund Hruška
Browse files

Refactor: Simplify short-circuit evaluation

parent d598ac5d
Branches
No related tags found
No related merge requests found
Pipeline #19735 passed
...@@ -634,10 +634,7 @@ class Filter(Interpreter): ...@@ -634,10 +634,7 @@ class Filter(Interpreter):
Returns: Returns:
True if either subtree evaluates to True, otherwise False. True if either subtree evaluates to True, otherwise False.
""" """
if (left := self.visit(l_tree)) is True: return self.visit(l_tree) or self.visit(r_tree)
return True
right = self.visit(r_tree)
return left or right
def and_op(self, l_tree: Tree, r_tree: Tree) -> bool: def and_op(self, l_tree: Tree, r_tree: Tree) -> bool:
""" """
...@@ -652,10 +649,7 @@ class Filter(Interpreter): ...@@ -652,10 +649,7 @@ class Filter(Interpreter):
Returns: Returns:
True if both subtrees evaluate to True, otherwise False. True if both subtrees evaluate to True, otherwise False.
""" """
if (left := self.visit(l_tree)) is False: return self.visit(l_tree) and self.visit(r_tree)
return False
right = self.visit(r_tree)
return left and right
def not_op(self, tree: Tree) -> bool: def not_op(self, tree: Tree) -> bool:
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment