mirror of
https://github.com/vlang/v.git
synced 2025-09-09 15:27:05 -04:00
This commit is contained in:
parent
4037765828
commit
7472a745e0
@ -141,7 +141,7 @@ fn (mut p Parser) call_args() []ast.CallArg {
|
||||
array_decompose = true
|
||||
}
|
||||
mut expr := ast.empty_expr
|
||||
if p.tok.kind in [.name, .key_type] && p.peek_tok.kind == .colon {
|
||||
if p.peek_tok.kind == .colon {
|
||||
// `foo(key:val, key2:val2)`
|
||||
expr = p.struct_init('void_type', .short_syntax, false)
|
||||
} else {
|
||||
|
13
vlib/v/tests/fns/call_struct_params_with_keyword_test.v
Normal file
13
vlib/v/tests/fns/call_struct_params_with_keyword_test.v
Normal file
@ -0,0 +1,13 @@
|
||||
@[params]
|
||||
struct Config {
|
||||
dump bool
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
opt := Config{}
|
||||
run('x', dump: opt.dump)!
|
||||
}
|
||||
|
||||
fn run(source string, config Config) ! {
|
||||
dump(config)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user