Skip to content

Commit

Permalink
Add more nodes so unused analysis doesn’t get stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Apr 3, 2024
1 parent bf5d840 commit 2b541b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/analyzer/expression_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,4 +926,6 @@ pub(crate) fn add_decision_dataflow(
(expr_pos.start_offset() as u32, expr_pos.end_offset() as u32),
Rc::new(cond_type),
);

analysis_data.data_flow_graph.add_node(decision_node);
}
4 changes: 1 addition & 3 deletions src/analyzer/stmt/if_conditional_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,7 @@ pub(crate) fn add_branch_dataflow(
);
}

if analysis_data.data_flow_graph.kind == GraphKind::FunctionBody {
analysis_data.data_flow_graph.add_node(branch_node);
}
analysis_data.data_flow_graph.add_node(branch_node);
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/code_info/data_flow/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,13 @@ impl DataFlowGraph {

let mut origin_nodes = vec![];

let mut child_node_ids = vec![assignment_node_id.clone()];
let mut child_node_ids = vec![];

if self.vertices.contains_key(assignment_node_id)
|| self.sources.contains_key(assignment_node_id)
{
child_node_ids.push(assignment_node_id.clone());
}

for _ in 0..50 {
let mut all_parent_nodes = vec![];
Expand Down

0 comments on commit 2b541b2

Please sign in to comment.