(self)
return True
Iterator based check.

        With respect to a certain variable/value A,
        - there must be at least one exit condition being A//Iterator//HasNext == 0
        - there must be at least one local that ticks the iterator next: A//Iterator//Next
Iterator based check.
Iterator based check .
def _is_bounded_iterator_based(self):
        """
        Iterator based check.

        With respect to a certain variable/value A,
        - there must be at least one exit condition being A//Iterator//HasNext == 0
        - there must be at least one local that ticks the iterator next: A//Iterator//Next
        """

        # Condition 0
        check_0 = lambda cond: (isinstance(cond, Condition) and
                                cond.op == Condition.Equal and
                                cond.val1 == 0 and
                                isinstance(cond.val0, AnnotatedVariable) and
                                cond.val0.type == VariableTypes.HasNext
                                )

        check_0_results = [ (check_0(stmt[0]), stmt[0]) for stmt in self.loop_exit_stmts ]
        check_0_conds = [ cond for r, cond in check_0_results if r ]  # remove all False ones

        if not check_0_conds:
            return None

        the_iterator = check_0_conds[0].val0.variable

        # Condition 1
        check_1 = lambda local: (isinstance(local, AnnotatedVariable) and
                                 local.type == VariableTypes.Next and
                                 local.variable == the_iterator
                                 )

        if not any([ check_1(local) for local in self.locals.values() ]):
            return None

        return True
def _is_bounded_iterator_based ( self ) : # Condition 0 check_0 = lambda cond : ( isinstance ( cond , Condition ) and cond . op == Condition . Equal and cond . val1 == 0 and isinstance ( cond . val0 , AnnotatedVariable ) and cond . val0 . type == VariableTypes . HasNext ) check_0_results = [ ( check_0 ( stmt [ 0 ] ) , stmt [ 0 ] ) for stmt in self . loop_exit_stmts ] check_0_conds = [ cond for r , cond in check_0_results if r ] # remove all False ones if not check_0_conds : return None the_iterator = check_0_conds [ 0 ] . val0 . variable # Condition 1 check_1 = lambda local : ( isinstance ( local , AnnotatedVariable ) and local . type == VariableTypes . Next and local . variable == the_iterator ) if not any ( [ check_1 ( local ) for local in self . locals . values ( ) ] ) : return None return True