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
评论列表
文章目录