From f04cd08e4d8960eb59b91097e675cf086f6687e0 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Tue, 17 Nov 2020 11:34:28 +0000 Subject: [PATCH] feat: add original offset to location --- --- a/crates/jrsonnet-evaluator/src/trace/location.rs +++ b/crates/jrsonnet-evaluator/src/trace/location.rs @@ -1,5 +1,7 @@ #[derive(Clone, PartialEq, Debug)] pub struct CodeLocation { + pub offset: usize, + pub line: usize, pub column: usize, @@ -25,6 +27,7 @@ let mut out = vec![ CodeLocation { + offset: 0, column: 0, line: 0, line_start_offset: 0, @@ -40,6 +43,7 @@ Some(x) if x.0 == pos => { let out_idx = x.1; with_no_known_line_ending.push(out_idx); + out[out_idx].offset = pos; out[out_idx].line = line; out[out_idx].column = column; out[out_idx].line_start_offset = this_line_offset; @@ -82,12 +86,14 @@ ), vec![ CodeLocation { + offset: 0, line: 1, column: 2, line_start_offset: 0, - line_end_offset: 11 + line_end_offset: 11, }, CodeLocation { + offset: 14, line: 2, column: 4, line_start_offset: 12, -- gitstuff