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

parser: fix infinite loop for type Handler = fn (test string) string without newline at the end

This commit is contained in:
Delyan Angelov 2022-10-16 10:42:53 +03:00
parent f6844e9766
commit 710c2b22da
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
3 changed files with 7 additions and 0 deletions

View File

@ -471,6 +471,9 @@ fn (p &Parser) peek_token_after_var_list() token.Token {
mut n := 0
mut tok := p.tok
for {
if tok.kind == .eof {
break
}
if tok.kind == .key_mut {
n += 2
} else {
@ -495,6 +498,9 @@ fn (p &Parser) is_fn_type_decl() bool {
cur_ln := p.tok.line_nr
for {
tok = p.scanner.peek_token(n)
if tok.kind == .eof {
break
}
if tok.kind in [.lpar, .rpar] {
n++
prev_tok = tok

View File

@ -0,0 +1 @@
type Handler = fn (test string) string