mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: minor cleanup in call_args() (#9344)
This commit is contained in:
parent
f28e67d526
commit
a6c2c5ba88
@ -128,21 +128,21 @@ pub fn (mut p Parser) call_args() []ast.CallArg {
|
|||||||
p.next()
|
p.next()
|
||||||
array_decompose = true
|
array_decompose = true
|
||||||
}
|
}
|
||||||
mut e := ast.Expr{}
|
mut expr := ast.Expr{}
|
||||||
if p.tok.kind == .name && p.peek_tok.kind == .colon {
|
if p.tok.kind == .name && p.peek_tok.kind == .colon {
|
||||||
// `foo(key:val, key2:val2)`
|
// `foo(key:val, key2:val2)`
|
||||||
e = p.struct_init(true) // short_syntax:true
|
expr = p.struct_init(true) // short_syntax:true
|
||||||
} else {
|
} else {
|
||||||
e = p.expr(0)
|
expr = p.expr(0)
|
||||||
}
|
}
|
||||||
if array_decompose {
|
if array_decompose {
|
||||||
e = ast.ArrayDecompose{
|
expr = ast.ArrayDecompose{
|
||||||
expr: e
|
expr: expr
|
||||||
pos: p.tok.position()
|
pos: p.tok.position()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if mut e is ast.StructInit {
|
if mut expr is ast.StructInit {
|
||||||
e.pre_comments << comments
|
expr.pre_comments << comments
|
||||||
comments = []ast.Comment{}
|
comments = []ast.Comment{}
|
||||||
}
|
}
|
||||||
pos := arg_start_pos.extend(p.prev_tok.position())
|
pos := arg_start_pos.extend(p.prev_tok.position())
|
||||||
@ -150,7 +150,7 @@ pub fn (mut p Parser) call_args() []ast.CallArg {
|
|||||||
args << ast.CallArg{
|
args << ast.CallArg{
|
||||||
is_mut: is_mut
|
is_mut: is_mut
|
||||||
share: table.sharetype_from_flags(is_shared, is_atomic)
|
share: table.sharetype_from_flags(is_shared, is_atomic)
|
||||||
expr: e
|
expr: expr
|
||||||
comments: comments
|
comments: comments
|
||||||
pos: pos
|
pos: pos
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user