(ccgraph, ast_list, change_stats)
| 68 | |
| 69 | |
| 70 | def update_graph(ccgraph, ast_list, change_stats): |
| 71 | for ast in ast_list: |
| 72 | filename = ast.attrib['filename'] |
| 73 | for function in ast.findall('./srcml:function', namespaces=ns): |
| 74 | caller_name, _, _ = handle_function(function) |
| 75 | if not caller_name: |
| 76 | continue |
| 77 | |
| 78 | if caller_name not in ccgraph: |
| 79 | ccgraph.add_node(caller_name, [filename]) |
| 80 | else: |
| 81 | files = ccgraph.nodes()[caller_name]['files'] |
| 82 | if filename not in files: |
| 83 | ccgraph.update_node_files(caller_name, files + [filename]) |
| 84 | |
| 85 | for call in function.xpath('.//srcml:call', namespaces=ns): |
| 86 | try: |
| 87 | callee_name = handle_call(call) |
| 88 | except NotFunctionCallError: |
| 89 | continue |
| 90 | except: |
| 91 | print("Callee name not found (in %s)" % caller_name) |
| 92 | continue |
| 93 | |
| 94 | if callee_name not in ccgraph: |
| 95 | # Pass [] to files argument since we don't know |
| 96 | # which file this node belongs to |
| 97 | ccgraph.add_node(callee_name, []) |
| 98 | ccgraph.add_edge(caller_name, callee_name) |
| 99 | |
| 100 | for func, fstat in change_stats.items(): |
| 101 | if func not in ccgraph: |
| 102 | print("%s in change_stats but not in ccgraph" % func_name) |
| 103 | continue |
| 104 | ccgraph.update_node_history(func, fstat['adds'], fstat['dels']) |
| 105 | |
| 106 | |
| 107 | def get_func_ranges_c(root): |
no test coverage detected