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

parser: fix fn argument type position (#15102)

This commit is contained in:
yuyi
2022-07-17 15:55:20 +08:00
committed by GitHub
parent 3075e35237
commit 78242627c3
4 changed files with 11 additions and 9 deletions

View File

@@ -830,6 +830,7 @@ fn (mut p Parser) fn_args() ([]ast.Param, bool, bool) {
}
pos := p.tok.pos()
mut arg_type := p.parse_type()
type_pos := pos.extend(p.prev_tok.pos())
if arg_type == 0 {
// error is added in parse_type
return []ast.Param{}, false, false
@@ -884,7 +885,7 @@ fn (mut p Parser) fn_args() ([]ast.Param, bool, bool) {
name: name
is_mut: is_mut
typ: arg_type
type_pos: pos
type_pos: type_pos
}
arg_no++
if arg_no > 1024 {
@@ -940,6 +941,7 @@ fn (mut p Parser) fn_args() ([]ast.Param, bool, bool) {
}
pos := p.tok.pos()
mut typ := p.parse_type()
type_pos[0] = pos.extend(p.prev_tok.pos())
if typ == 0 {
// error is added in parse_type
return []ast.Param{}, false, false