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

Function get_vd_end_offset

src/ast/loc.rs:93–106  ·  view source on GitHub ↗
(vd_end: &BareSourceLocation, src_file: &Path)

Source from the content-addressed store, hash-verified

91}
92
93fn get_vd_end_offset(vd_end: &BareSourceLocation, src_file: &Path) -> Result<usize> {
94 let buffer = std::fs::read_to_string(src_file).unwrap();
95 let end_loc = vd_end.offset + vd_end.tok_len;
96 let buf = &buffer[end_loc..];
97 let comma_offset = buf.find(',');
98 let semicolon_offset = buf.find(';');
99 if comma_offset.is_none() {
100 return Ok(end_loc + semicolon_offset.unwrap());
101 }
102 if comma_offset.unwrap() < semicolon_offset.unwrap() {
103 return Ok(end_loc + comma_offset.unwrap());
104 }
105 Ok(end_loc + semicolon_offset.unwrap())
106}
107
108/// if there is other vd in this range.
109fn has_other_before_vd(

Callers 1

get_var_uninit_locFunction · 0.85

Calls 1

is_noneMethod · 0.80

Tested by

no test coverage detected