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

Method find_nested_call

src/ast/visitor.rs:379–399  ·  view source on GitHub ↗
(&self, nested: &[&str])

Source from the content-addressed store, hash-verified

377 }
378
379 pub fn find_nested_call(&self, nested: &[&str]) -> Option<(&CallExpr, &CallExpr, String)> {
380 let mut worklist = WorkList::new();
381 worklist.push(&self.ast);
382 while !worklist.empty() {
383 let curr = worklist.pop();
384 if let Clang::CallExpr(ce) = &curr.kind {
385 for arg in ce.get_childs(curr).iter() {
386 if let Clang::CallExpr(nested_call) = &arg.kind {
387 let nested_call_name = nested_call.get_name_as_string(arg);
388 if nested.contains(&nested_call_name.as_str()) {
389 return Some((ce, nested_call, nested_call_name));
390 }
391 }
392 }
393 }
394 for child in &curr.inner {
395 worklist.push(child);
396 }
397 }
398 None
399 }
400}
401
402pub mod utils {

Callers 1

handle_nested_callMethod · 0.80

Calls 5

emptyMethod · 0.80
popMethod · 0.80
get_name_as_stringMethod · 0.80
pushMethod · 0.45
get_childsMethod · 0.45

Tested by

no test coverage detected