File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
frontend/catalyst/python_interface/visualization Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -427,12 +427,16 @@ def _flatten_if_op(op: scf.IfOp) -> list[Region]:
427427 has_quantum_ops = False
428428 nested_if_op = None
429429 for op in else_block .ops :
430+ if isinstance (op , scf .IfOp ):
431+ nested_if_op = op
432+ # No need to walk this op as this will be
433+ # recursively handled down below
434+ continue
430435 for internal_op in op .walk ():
431- if isinstance (internal_op , scf .IfOp ):
432- nested_if_op = internal_op
433- break
434- if "quantum" in internal_op .name :
436+ if type (internal_op ) in quantum .Quantum .operations :
435437 has_quantum_ops = True
438+ # No need to check anything else
439+ break
436440
437441 if nested_if_op and not has_quantum_ops :
438442 # Recursively flatten any IfOps found in said block
You can’t perform that action at this time.
0 commit comments