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

Function get_pre_vd_begin

src/ast/loc.rs:54–62  ·  view source on GitHub ↗

Get the beginning offset of the previous one VarDecl;

(vd_begin: &BareSourceLocation, src_file: &Path)

Source from the content-addressed store, hash-verified

52
53/// Get the beginning offset of the previous one VarDecl;
54fn get_pre_vd_begin(vd_begin: &BareSourceLocation, src_file: &Path) -> Result<usize> {
55 let begin_loc = vd_begin.offset;
56 let buffer = std::fs::read_to_string(src_file)?;
57 let buf = &buffer[..begin_loc];
58 let comma = buf
59 .rfind(',')
60 .ok_or_else(|| eyre::eyre!("a prefix vd should be separated by ',' : {buf}"))?;
61 Ok(comma)
62}
63
64pub fn get_loc_before_stmt(src_file: &Path, range: &SourceRange) -> Result<usize> {
65 let begin_loc = get_sr_begin_loc(range)?.offset;

Callers 1

get_var_uninit_locFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected