mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: turn the pointer map notice into a warning and fix all code using it
This commit is contained in:
parent
e8108f21e0
commit
aba7bcde85
@ -1,10 +1,11 @@
|
||||
## V 0.3.3
|
||||
*Not yet released*
|
||||
- add `math.vec` module for generic vector math.
|
||||
- Accessing a pointer map value requires an `or{}` block outside `unsafe`.
|
||||
- `math.vec` module for generic vector math.
|
||||
- `go foo()` has been replaced with `spawn foo()` (launches an OS thread, `go` will be used for
|
||||
upcoming coroutines instead).
|
||||
- vfmt now supports `// vfmt off` and `// vfmt on` for turning off the formatting locally for *short* snippets of code. Useful for keeping your carefully arranged matrices intact.
|
||||
- support match branch range expressions with consts: `match x { const1...const2 {} }`
|
||||
- Match branch range expressions with consts: `match x { const1...const2 {} }`
|
||||
|
||||
## V 0.3.2
|
||||
*31 Oct 2022*
|
||||
|
@ -38,7 +38,7 @@ fn start_server() ! {
|
||||
slog('s.on_message_ref')
|
||||
// for _, cli in m.clients {
|
||||
for i, _ in m.clients {
|
||||
mut c := m.clients[i]
|
||||
mut c := m.clients[i] or { continue }
|
||||
if c.client.state == .open && c.client.id != ws.id {
|
||||
c.client.write(msg.payload, websocket.OPCode.text_frame) or { panic(err) }
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ fn (mut s Server) handle_ping() {
|
||||
for s.state == .open {
|
||||
time.sleep(s.ping_interval * time.second)
|
||||
for i, _ in s.clients {
|
||||
mut c := s.clients[i]
|
||||
mut c := s.clients[i] or { continue }
|
||||
if c.client.state == .open {
|
||||
c.client.ping() or {
|
||||
s.logger.debug('server-> error sending ping to client')
|
||||
@ -125,7 +125,9 @@ fn (mut s Server) serve_client(mut c Client) ! {
|
||||
// the client is accepted
|
||||
c.socket_write(handshake_response.bytes())!
|
||||
lock {
|
||||
s.clients[server_client.client.id] = server_client
|
||||
unsafe {
|
||||
s.clients[server_client.client.id] = server_client
|
||||
}
|
||||
}
|
||||
s.setup_callbacks(mut server_client)
|
||||
c.listen() or {
|
||||
|
@ -3818,7 +3818,7 @@ fn (mut c Checker) index_expr(mut node ast.IndexExpr) ast.Type {
|
||||
if !c.inside_unsafe && !c.is_builtin_mod && typ_sym.kind == .map && node.or_expr.stmts.len == 0 {
|
||||
elem_type := c.table.value_type(typ)
|
||||
if elem_type.is_real_pointer() {
|
||||
c.note('accessing a pointer map value requires an `or{}` block outside `unsafe`',
|
||||
c.warn('accessing a pointer map value requires an `or{}` block outside `unsafe`',
|
||||
node.pos)
|
||||
}
|
||||
}
|
||||
|
@ -412,15 +412,17 @@ fn (g &JsGen) get_all_test_function_names() []string {
|
||||
}
|
||||
|
||||
pub fn (mut g JsGen) enter_namespace(name string) {
|
||||
if unsafe { g.namespaces[name] == 0 } {
|
||||
// create a new namespace
|
||||
ns := &Namespace{
|
||||
name: name
|
||||
unsafe {
|
||||
if g.namespaces[name] == 0 {
|
||||
// create a new namespace
|
||||
ns := &Namespace{
|
||||
name: name
|
||||
}
|
||||
g.namespaces[name] = ns
|
||||
g.ns = ns
|
||||
} else {
|
||||
g.ns = g.namespaces[name]
|
||||
}
|
||||
g.namespaces[name] = ns
|
||||
g.ns = ns
|
||||
} else {
|
||||
g.ns = g.namespaces[name]
|
||||
}
|
||||
g.inside_builtin = name == 'builtin'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user