def visit_For(self, node):
        pre = self.visit(node.pre)
        condition = self.visit(node.condition)
        post = self.visit(node.post)

        if check_overwrite(condition):
            node.condition = condition
        
        new_statement = []
        const_dict = copy.deepcopy(self.const_dict)
        
        # pre
        dst = pre.left.name
        val = pre.right
        const_dict[dst] = val

        while True:
            # cond
            cvisitor = ForReplaceVisitor(const_dict)
            cond = cvisitor.visit(condition)
            
            if not check_constant(cond):
                return node
            
            if not cond:
                break

            rslt = cvisitor.visit(copy.deepcopy(node.statement))
            new_statement.append(rslt)

            # post
            if post.left.name != dst:
                raise ValueError("Destination of 'post' must be same with 'pre': %s" % dst)

            const_dict[dst] = cvisitor.visit(post.right)

        return new_statement
dataset/ETHPy150Open PyHDI/veriloggen/veriloggen/resolver/resolver.py/ReplaceVisitor.visit_For/original