find the FunctionDecl node named with fd_name.
(&self, fd_name: &str)
| 58 | |
| 59 | /// find the FunctionDecl node named with fd_name. |
| 60 | pub fn find_fd(&self, fd_name: &str) -> Option<&Node> { |
| 61 | let mut worklist = WorkList::new(); |
| 62 | worklist.push(&self.ast); |
| 63 | while !worklist.empty() { |
| 64 | let curr = worklist.pop(); |
| 65 | if let Clang::FunctionDecl(fd) = &curr.kind { |
| 66 | let name = fd.get_name(); |
| 67 | if name == fd_name { |
| 68 | return Some(curr); |
| 69 | } |
| 70 | } |
| 71 | worklist.push_childs(curr.get_childs()); |
| 72 | } |
| 73 | None |
| 74 | } |
| 75 | |
| 76 | /// find the source code location range of the FuntionDecl specified with name of fd_name. |
| 77 | /// The range starts from type declaration and ends with the end of function name. |
no test coverage detected