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

checker: check the fn decl for anon fns too (#7529)

This commit is contained in:
Swastik Baranwal
2021-01-30 02:41:05 +05:30
committed by GitHub
parent b8d93df55e
commit e03ece2a4b
4 changed files with 23 additions and 10 deletions

View File

@@ -18,12 +18,6 @@ mut:
}
pub fn dial_udp(laddr string, raddr string) ?&UdpConn {
// Dont have to do this when its fixed
// this just allows us to store this `none` optional in a struct
resolve_wrapper := fn (raddr string) ?Addr {
x := resolve_addr(raddr, .inet, .udp) or { return none }
return x
}
local := resolve_addr(laddr, .inet, .udp) ?
sbase := new_udp_socket(local.port) ?
sock := UdpSocket{
@@ -38,6 +32,13 @@ pub fn dial_udp(laddr string, raddr string) ?&UdpConn {
}
}
fn resolve_wrapper(raddr string) ?Addr {
// Dont have to do this when its fixed
// this just allows us to store this `none` optional in a struct
x := resolve_addr(raddr, .inet, .udp) or { return none }
return x
}
pub fn (mut c UdpConn) write_ptr(b byteptr, len int) ? {
remote := c.sock.remote() or { return err_no_udp_remote }
return c.write_to_ptr(remote, b, len)