1 parent d446a5a commit 75f606aCopy full SHA for 75f606a
1 file changed
bytecode/src/lib.rs
@@ -15,8 +15,8 @@ use std::{collections::BTreeSet, fmt, hash};
15
/// Sourcecode location.
16
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
17
pub struct Location {
18
- row: usize,
19
- column: usize,
+ row: u32,
+ column: u32,
20
}
21
22
impl Location {
@@ -28,17 +28,19 @@ impl Location {
28
/// let loc = Location::new(10, 10);
29
/// ```
30
pub fn new(row: usize, column: usize) -> Self {
31
+ let row = row.try_into().expect("Location::row over u32");
32
+ let column = column.try_into().expect("Location::column over u32");
33
Location { row, column }
34
35
36
/// Current row
37
pub fn row(&self) -> usize {
- self.row
38
+ self.row as usize
39
40
41
/// Current column
42
pub fn column(&self) -> usize {
- self.column
43
+ self.column as usize
44
45
46
0 commit comments