@@ -653,53 +653,6 @@ def translate_isinstance(builder: IRBuilder, expr: CallExpr, callee: RefExpr) ->
653653 obj = builder .accept (obj_expr , can_borrow = can_borrow )
654654 return builder .builder .isinstance_helper (obj , irs , expr .line )
655655
656- if isinstance (type_expr , TupleExpr ):
657- if not type_expr .items :
658- # we can compile this case to a noop
659- return builder .false ()
660-
661- nodes : list [str ] = []
662- for item in type_expr .items :
663- if not isinstance (item , RefExpr ):
664- return None
665- if item .node is None :
666- return None
667- if item .node .fullname not in nodes :
668- nodes .append (item .node .fullname )
669-
670- descs = [isinstance_primitives .get (fullname ) for fullname in nodes ]
671-
672- obj = builder .accept (expr .args [0 ])
673-
674- retval = Register (bool_rprimitive )
675- pass_block = BasicBlock ()
676- fail_block = BasicBlock ()
677- exit_block = BasicBlock ()
678-
679- # Chain the checks: if any succeed, jump to pass_block; else, continue
680- for i , desc in enumerate (descs ):
681- is_last = i == len (descs ) - 1
682- next_block = fail_block if is_last else BasicBlock ()
683- builder .add_bool_branch (
684- builder .primitive_op (desc , [obj ], expr .line ), pass_block , next_block
685- )
686- if not is_last :
687- builder .activate_block (next_block )
688-
689- # If any check passed
690- builder .activate_block (pass_block )
691- builder .assign (retval , builder .true (), expr .line )
692- builder .goto (exit_block )
693-
694- # If all checks failed
695- builder .activate_block (fail_block )
696- builder .assign (retval , builder .false (), expr .line )
697- builder .goto (exit_block )
698-
699- # Return the result
700- builder .activate_block (exit_block )
701- return retval
702-
703656 if isinstance (type_expr , RefExpr ):
704657 if node := type_expr .node :
705658 if desc := isinstance_primitives .get (node .fullname ):
0 commit comments