interprocedural_cfg.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:pyt 作者: python-security 项目源码 文件源码
def return_handler(self, call_node, function_nodes, saved_function_call_index, first_node):
        """Handle the return from a function during a function call.

        Args:
            call_node(ast.Call) : The node that calls the definition.
            function_nodes(list[Node]): List of nodes of the function being called.
            saved_function_call_index(int): Unique number for each call.
            first_node(EntryOrExitNode or RestoreNode): Used to connect previous statements to this function.
        """
        for node in function_nodes:
            # Only `Return`s and `Raise`s can be of type ConnectToExitNode
            if isinstance(node, ConnectToExitNode):
                # Create e.g. ¤call_1 = ret_func_foo RestoreNode
                LHS = CALL_IDENTIFIER + 'call_' + str(saved_function_call_index)
                RHS = 'ret_' + get_call_names_as_string(call_node.func)
                return_node = RestoreNode(LHS + ' = ' + RHS,
                                          LHS,
                                          [RHS],
                                          line_number=call_node.lineno,
                                          path=self.filenames[-1])
                return_node.first_node = first_node

                self.nodes[-1].connect(return_node)
                self.nodes.append(return_node)
                return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号