more rust relationships
This commit is contained in:
+38
-2
@@ -2130,9 +2130,24 @@ def build_indexes():
|
|||||||
|
|
||||||
# Connect return type if available
|
# Connect return type if available
|
||||||
return_type = m.get("return_type")
|
return_type = m.get("return_type")
|
||||||
if return_type and return_type != "void":
|
if return_type and return_type not in ['void', '()', 'Result', '']:
|
||||||
for type_id, type_data in graph.find_nodes(name=return_type):
|
for type_id, type_data in graph.find_nodes(name=return_type):
|
||||||
graph.add_edge(node_id, type_id, "returns")
|
graph.add_edge(node_id, type_id, "returns")
|
||||||
|
|
||||||
|
# Connect parameter types
|
||||||
|
parameters = m.get("parameters", [])
|
||||||
|
for param in parameters:
|
||||||
|
if ':' in param:
|
||||||
|
param_parts = param.split(':')
|
||||||
|
if len(param_parts) >= 2:
|
||||||
|
param_type = param_parts[-1].strip()
|
||||||
|
param_type = param_type.replace('&', '').replace('mut ', '').strip()
|
||||||
|
if (param_type and
|
||||||
|
param_type not in ['self', '&self', '&mut self', 'mut self'] and
|
||||||
|
not param_type.startswith('&') and
|
||||||
|
param_type not in ['i32', 'i64', 'f32', 'f64', 'bool', 'String', 'str']):
|
||||||
|
for type_id, type_data in graph.find_nodes(name=param_type):
|
||||||
|
graph.add_edge(node_id, type_id, "uses_parameter")
|
||||||
else:
|
else:
|
||||||
# Regular function
|
# Regular function
|
||||||
graph.add_node(node_id, **base_attrs, type=node_type,
|
graph.add_node(node_id, **base_attrs, type=node_type,
|
||||||
@@ -2140,11 +2155,32 @@ def build_indexes():
|
|||||||
parameters=m.get("parameters", []))
|
parameters=m.get("parameters", []))
|
||||||
graph.add_edge(file_node_id, node_id, "contains")
|
graph.add_edge(file_node_id, node_id, "contains")
|
||||||
|
|
||||||
|
# Connect return type if available
|
||||||
|
return_type = m.get("return_type")
|
||||||
|
if return_type and return_type not in ['void', '()', 'Result', '']:
|
||||||
|
for type_id, type_data in graph.find_nodes(name=return_type):
|
||||||
|
graph.add_edge(node_id, type_id, "returns")
|
||||||
|
|
||||||
|
# Connect parameter types
|
||||||
|
parameters = m.get("parameters", [])
|
||||||
|
for param in parameters:
|
||||||
|
if ':' in param:
|
||||||
|
param_parts = param.split(':')
|
||||||
|
if len(param_parts) >= 2:
|
||||||
|
param_type = param_parts[-1].strip()
|
||||||
|
param_type = param_type.replace('&', '').replace('mut ', '').strip()
|
||||||
|
if (param_type and
|
||||||
|
param_type not in ['self', '&self', '&mut self', 'mut self'] and
|
||||||
|
not param_type.startswith('&') and
|
||||||
|
param_type not in ['i32', 'i64', 'f32', 'f64', 'bool', 'String', 'str']):
|
||||||
|
for type_id, type_data in graph.find_nodes(name=param_type):
|
||||||
|
graph.add_edge(node_id, type_id, "uses_parameter")
|
||||||
|
|
||||||
elif node_type in ["class", "struct", "interface", "enum"]:
|
elif node_type in ["class", "struct", "interface", "enum"]:
|
||||||
# Type definitions
|
# Type definitions
|
||||||
graph.add_node(node_id, **base_attrs, type=node_type,
|
graph.add_node(node_id, **base_attrs, type=node_type,
|
||||||
extends=m.get("extends"),
|
extends=m.get("extends"),
|
||||||
implements=m.get("implements", []),
|
implements=m.get("implements", []),¬
|
||||||
fields=m.get("fields", []), # Store fields as metadata, not separate nodes
|
fields=m.get("fields", []), # Store fields as metadata, not separate nodes
|
||||||
variants=m.get("variants", [])) # For enums
|
variants=m.get("variants", [])) # For enums
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user