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

compiler: fix panic on open bracket without newline

This commit is contained in:
Henrixounez 2019-08-09 20:19:37 +02:00 committed by Alexander Medvednikov
parent 5c29a7ef7d
commit 81cdda842c

View File

@ -769,7 +769,7 @@ fn (p mut Parser) check(expected Token) {
} }
p.fgen(p.strtok()) p.fgen(p.strtok())
// vfmt: increase indentation on `{` unless it's `{}` // vfmt: increase indentation on `{` unless it's `{}`
if expected == .lcbr && p.scanner.text[p.scanner.pos + 1] != `}` { if expected == .lcbr && p.scanner.pos + 1 < p.scanner.text.len && p.scanner.text[p.scanner.pos + 1] != `}` {
p.fgenln('') p.fgenln('')
p.fmt_inc() p.fmt_inc()
} }