(&self, var_name: &str)
| 123 | } |
| 124 | |
| 125 | pub fn find_vardecl(&self, var_name: &str) -> Option<&Node> { |
| 126 | let mut worklist = WorkList::new(); |
| 127 | worklist.push(&self.ast); |
| 128 | while !worklist.empty() { |
| 129 | let curr = worklist.pop(); |
| 130 | if let Clang::VarDecl(vd) = &curr.kind { |
| 131 | let name = vd.get_name_as_string(); |
| 132 | if name == var_name { |
| 133 | return Some(curr); |
| 134 | } |
| 135 | } |
| 136 | if let Clang::ParmVarDecl(pvd) = &curr.kind { |
| 137 | let name = pvd.get_name_as_string(); |
| 138 | if name == var_name { |
| 139 | return Some(curr); |
| 140 | } |
| 141 | } |
| 142 | worklist.push_childs(curr.get_childs()); |
| 143 | } |
| 144 | None |
| 145 | } |
| 146 | |
| 147 | pub fn find_binary_operator(&self, var_name: &str) -> Option<&Node> { |
| 148 | let mut worklist = WorkList::new(); |
no test coverage detected