aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Compiler/FlowControl.py
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2025-05-29 11:09:23 +0000
committerAlexander Smirnov <alex@ydb.tech>2025-05-29 11:09:23 +0000
commita34a6816abefdcfe2c00295edb510cc5c99ad52c (patch)
treea264baadccf7add09a1b285786307ddd774472a5 /contrib/tools/cython/Cython/Compiler/FlowControl.py
parent84ec9093e10073ab151bfe5f81037a0d017c2362 (diff)
parentfdbc38349df2ee0ddc678fa2bffe84786f9639a3 (diff)
downloadydb-a34a6816abefdcfe2c00295edb510cc5c99ad52c.tar.gz
Merge branch 'rightlib' into merge-libs-250529-1108
Diffstat (limited to 'contrib/tools/cython/Cython/Compiler/FlowControl.py')
-rw-r--r--contrib/tools/cython/Cython/Compiler/FlowControl.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/tools/cython/Cython/Compiler/FlowControl.py b/contrib/tools/cython/Cython/Compiler/FlowControl.py
index c8575435738..a9965b76c69 100644
--- a/contrib/tools/cython/Cython/Compiler/FlowControl.py
+++ b/contrib/tools/cython/Cython/Compiler/FlowControl.py
@@ -1381,3 +1381,45 @@ class ControlFlowAnalysis(CythonTransform):
self.mark_assignment(node.operand, fake_rhs_expr)
self.visitchildren(node)
return node
+
+ def visit_BoolBinopNode(self, node):
+ # Note - I don't believe BoolBinopResultNode needs special handling beyond this
+ assert len(node.subexprs) == 2 # operand1 and operand2 only
+
+ next_block = self.flow.newblock()
+ parent = self.flow.block
+
+ self._visit(node.operand1)
+
+ self.flow.nextblock()
+ self._visit(node.operand2)
+ if self.flow.block:
+ self.flow.block.add_child(next_block)
+
+ parent.add_child(next_block)
+
+ if next_block.parents:
+ self.flow.block = next_block
+ else:
+ self.flow.block = None
+ return node
+
+ def visit_CondExprNode(self, node):
+ assert len(node.subexprs) == 3
+ self._visit(node.test)
+ parent = self.flow.block
+ next_block = self.flow.newblock()
+ self.flow.nextblock()
+ self._visit(node.true_val)
+ if self.flow.block:
+ self.flow.block.add_child(next_block)
+ self.flow.nextblock(parent=parent)
+ self._visit(node.false_val)
+ if self.flow.block:
+ self.flow.block.add_child(next_block)
+
+ if next_block.parents:
+ self.flow.block = next_block
+ else:
+ self.flow.block = None
+ return node