mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
dd06698ee3
commit
3f351036a2
@ -736,7 +736,8 @@ fn (mut p Parser) fn_args() ([]ast.Param, bool, bool) {
|
||||
|| (p.peek_tok.kind == .comma && p.table.known_type(argname))
|
||||
|| p.peek_tok.kind == .dot || p.peek_tok.kind == .rpar
|
||||
|| (p.tok.kind == .key_mut && (p.peek_token(2).kind == .comma
|
||||
|| p.peek_token(2).kind == .rpar))
|
||||
|| p.peek_token(2).kind == .rpar || (p.peek_token(1).kind == .name
|
||||
&& p.peek_token(2).kind == .dot)))
|
||||
// TODO copy pasta, merge 2 branches
|
||||
if types_only {
|
||||
mut arg_no := 1
|
||||
|
16
vlib/v/tests/fn_type_only_argument_test.v
Normal file
16
vlib/v/tests/fn_type_only_argument_test.v
Normal file
@ -0,0 +1,16 @@
|
||||
module main
|
||||
|
||||
import time
|
||||
|
||||
struct Game {
|
||||
update fn (mut time.Time) = fn (mut time time.Time) {}
|
||||
draw fn (mut time.Time) = fn (mut time time.Time) {}
|
||||
mut:
|
||||
time time.Time
|
||||
}
|
||||
|
||||
fn test_fn_type_only_argument() {
|
||||
mut game := Game{}
|
||||
game.time = time.Time{}
|
||||
assert true
|
||||
}
|
Loading…
Reference in New Issue
Block a user