Get the beginning offset of the previous one VarDecl;
(vd_begin: &BareSourceLocation, src_file: &Path)
| 52 | |
| 53 | /// Get the beginning offset of the previous one VarDecl; |
| 54 | fn 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 | |
| 64 | pub fn get_loc_before_stmt(src_file: &Path, range: &SourceRange) -> Result<usize> { |
| 65 | let begin_loc = get_sr_begin_loc(range)?.offset; |
no outgoing calls
no test coverage detected