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

compiler: fix line numbers in unused variable error messages

This commit is contained in:
Delyan Angelov
2019-09-20 13:42:37 +03:00
committed by Alexander Medvednikov
parent f657d70a67
commit f042dfb861
4 changed files with 51 additions and 13 deletions

View File

@@ -61,6 +61,24 @@ fn new_scanner(file_path string) &Scanner {
return scanner
}
struct ScannerPos {
mut:
pos int
line_nr int
}
fn (s ScannerPos) str() string {
return 'ScannerPos{ ${s.pos:5d} , ${s.line_nr:5d} }'
}
fn (s &Scanner) get_scanner_pos() ScannerPos {
return ScannerPos{ pos: s.pos line_nr: s.line_nr }
}
fn (s mut Scanner) goto_scanner_position(scp ScannerPos) {
s.pos = scp.pos
s.line_nr = scp.line_nr
}
// TODO remove once multiple return values are implemented
struct ScanRes {
tok Token