git.delta.rocks / jrsonnet / refs/commits / f04cd08e4d89

difftreelog

feat add original offset to location

Yaroslav Bolyukin2020-11-17parent: #ce2d8d5.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-evaluator/src/trace/location.rsdiffbeforeafterboth
1#[derive(Clone, PartialEq, Debug)]1#[derive(Clone, PartialEq, Debug)]
2pub struct CodeLocation {2pub struct CodeLocation {
3 pub offset: usize,
4
3 pub line: usize,5 pub line: usize,
4 pub column: usize,6 pub column: usize,
2527
26 let mut out = vec![28 let mut out = vec![
27 CodeLocation {29 CodeLocation {
30 offset: 0,
28 column: 0,31 column: 0,
29 line: 0,32 line: 0,
30 line_start_offset: 0,33 line_start_offset: 0,
40 Some(x) if x.0 == pos => {43 Some(x) if x.0 == pos => {
41 let out_idx = x.1;44 let out_idx = x.1;
42 with_no_known_line_ending.push(out_idx);45 with_no_known_line_ending.push(out_idx);
46 out[out_idx].offset = pos;
43 out[out_idx].line = line;47 out[out_idx].line = line;
44 out[out_idx].column = column;48 out[out_idx].column = column;
45 out[out_idx].line_start_offset = this_line_offset;49 out[out_idx].line_start_offset = this_line_offset;
82 ),86 ),
83 vec![87 vec![
84 CodeLocation {88 CodeLocation {
89 offset: 0,
85 line: 1,90 line: 1,
86 column: 2,91 column: 2,
87 line_start_offset: 0,92 line_start_offset: 0,
88 line_end_offset: 1193 line_end_offset: 11,
89 },94 },
90 CodeLocation {95 CodeLocation {
96 offset: 14,
91 line: 2,97 line: 2,
92 column: 4,98 column: 4,
93 line_start_offset: 12,99 line_start_offset: 12,