find the callexpr of the i-th call.
(&self, call_name: &str, call_i: usize)
| 230 | |
| 231 | /// find the callexpr of the i-th call. |
| 232 | pub fn find_callexpr(&self, call_name: &str, call_i: usize) -> Option<&Node> { |
| 233 | let mut worklist = WorkList::new(); |
| 234 | worklist.push(&self.ast); |
| 235 | let mut i = 0; |
| 236 | while !worklist.empty() { |
| 237 | let curr = worklist.pop(); |
| 238 | if let Clang::CallExpr(ce) = &curr.kind { |
| 239 | let name = ce.get_name_as_string(curr); |
| 240 | if name == call_name { |
| 241 | if call_i == i { |
| 242 | return Some(curr); |
| 243 | } else { |
| 244 | i += 1; |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | worklist.push_childs(curr.get_childs()); |
| 249 | } |
| 250 | None |
| 251 | } |
| 252 | |
| 253 | pub fn find_callexprs(&self, call_name: &str) -> Vec<&Node> { |
| 254 | let mut worklist = WorkList::new(); |
no test coverage detected