mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Make Position::{line, column} fields private
This commit is contained in:
parent
fae1bb4458
commit
443d738f9b
5 changed files with 115 additions and 88 deletions
|
@ -40,10 +40,7 @@ impl<'a> State<'a> {
|
|||
|
||||
/// Returns the current position
|
||||
pub const fn pos(&self) -> Position {
|
||||
Position {
|
||||
line: self.xyzlcol.line,
|
||||
column: self.xyzlcol.column,
|
||||
}
|
||||
Position::new(self.xyzlcol.line, self.xyzlcol.column)
|
||||
}
|
||||
|
||||
/// Returns whether the parser has reached the end of the input
|
||||
|
@ -97,14 +94,14 @@ impl<'a> State<'a> {
|
|||
pub fn len_region(&self, length: u16) -> Region {
|
||||
Region::new(
|
||||
self.pos(),
|
||||
Position {
|
||||
line: self.xyzlcol.line,
|
||||
column: self
|
||||
Position::new(
|
||||
self.xyzlcol.line,
|
||||
self
|
||||
.xyzlcol
|
||||
.column
|
||||
.checked_add(length)
|
||||
.unwrap_or_else(|| panic!("len_region overflowed")),
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue