stubs_handler.py 文件源码

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

项目:Typpete 作者: caterinaurban 项目源码 文件源码
def infer_file(tree, solver, used_names, infer_func, method_type=None):
        # Infer only structs that are used in the program to be inferred

        # Function definitions
        relevant_nodes = StubsHandler.get_relevant_nodes(tree, used_names)

        # Only give class definitions to the context to prevent the creation of Z3 constants for stub functions
        context = Context([stmt for stmt in tree.body if isinstance(stmt, ast.ClassDef)], solver)
        if method_type:
            # Add the flag in the statements to recognize the method statements during the inference
            for node in relevant_nodes:
                node.method_type = method_type

        for stmt in relevant_nodes:
            infer_func(stmt, context, solver)

        return context
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号