1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: keep single empty lines (#8189)

This commit is contained in:
Tim Basel
2021-01-19 14:49:40 +01:00
committed by GitHub
parent 103901a5cb
commit 129eee346b
20 changed files with 197 additions and 35 deletions

View File

@@ -20,6 +20,7 @@ pub fn (pos Position) extend(end Position) Position {
return {
pos |
len: end.pos - pos.pos + end.len
last_line: end.last_line
}
}
@@ -32,11 +33,16 @@ pub fn (pos Position) extend_with_last_line(end Position, last_line int) Positio
}
}
pub fn (mut pos Position) update_last_line(last_line int) {
pos.last_line = last_line - 1
}
[inline]
pub fn (tok &Token) position() Position {
return Position{
len: tok.len
line_nr: tok.line_nr - 1
pos: tok.pos
last_line: tok.line_nr - 1
}
}