MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / find_binary_operator

Method find_binary_operator

src/ast/visitor.rs:147–165  ·  view source on GitHub ↗
(&self, var_name: &str)

Source from the content-addressed store, hash-verified

145 }
146
147 pub fn find_binary_operator(&self, var_name: &str) -> Option<&Node> {
148 let mut worklist = WorkList::new();
149 worklist.push(&self.ast);
150 while !worklist.empty() {
151 let curr = worklist.pop();
152 if let Clang::BinaryOperator(bo) = &curr.kind {
153 let left = bo.get_lhs(curr);
154 if let Clang::DeclRefExpr(dre) = &left.kind {
155 let name = dre.get_name_as_string();
156 if var_name == name {
157 let right = bo.get_rhs(curr);
158 return Some(right);
159 }
160 }
161 }
162 worklist.push_childs(curr.get_childs());
163 }
164 None
165 }
166
167 pub fn visit_nth_library_call(&self, nth: usize) -> &Node {
168 let calls = self.visit_library_calls();

Callers 1

get_var_init_callMethod · 0.80

Calls 8

emptyMethod · 0.80
popMethod · 0.80
get_lhsMethod · 0.80
get_name_as_stringMethod · 0.80
get_rhsMethod · 0.80
push_childsMethod · 0.80
pushMethod · 0.45
get_childsMethod · 0.45

Tested by

no test coverage detected