mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
scanner: remove pos 0 hack which is no longer needed (#10935)
This commit is contained in:
@@ -688,11 +688,6 @@ fn (mut s Scanner) text_scan() token.Token {
|
||||
s.is_inter_end = true
|
||||
s.is_inter_start = false
|
||||
}
|
||||
if s.pos == 0 && next_char == ` ` {
|
||||
// If a single letter name at the start of the file, increment
|
||||
// Otherwise the scanner would be stuck at s.pos = 0
|
||||
s.pos++
|
||||
}
|
||||
return s.new_token(.name, name, name.len)
|
||||
} else if c.is_digit() || (c == `.` && nextc.is_digit()) {
|
||||
// `123`, `.123`
|
||||
|
||||
5
vlib/v/scanner/tests/position_0_err.out
Normal file
5
vlib/v/scanner/tests/position_0_err.out
Normal file
@@ -0,0 +1,5 @@
|
||||
vlib/v/scanner/tests/position_0_err.vv:1:1: error: unused variable: `i`
|
||||
1 | i := 'hello'
|
||||
| ^
|
||||
2 | x := 3
|
||||
3 | y := 2
|
||||
4
vlib/v/scanner/tests/position_0_err.vv
Normal file
4
vlib/v/scanner/tests/position_0_err.vv
Normal file
@@ -0,0 +1,4 @@
|
||||
i := 'hello'
|
||||
x := 3
|
||||
y := 2
|
||||
println(x + y)
|
||||
@@ -1,5 +1,4 @@
|
||||
// TODO: @medvednikov: autofree on script mode does not work when first variable is on position 0 due to the code in `cgen.v:1115`
|
||||
v := 't'
|
||||
|
||||
s := '${v}.tmp'
|
||||
|
||||
println(s)
|
||||
|
||||
Reference in New Issue
Block a user