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

v.markused: remove hash.init() function (map fn usages are detected more precisely)

This commit is contained in:
Delyan Angelov 2021-09-23 10:12:22 +03:00
parent b52f79e137
commit 79e33d92f1
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 7 additions and 6 deletions

View File

@ -6,12 +6,6 @@ fn C.wyhash(&byte, u64, u64, &u64) u64
fn C.wyhash64(u64, u64) u64
fn init() {
_ := {
1: 1
}
}
[inline]
pub fn wyhash_c(key &byte, len u64, seed u64) u64 {
return C.wyhash(key, len, seed, &u64(C._wyp))

View File

@ -358,6 +358,10 @@ fn (mut w Walker) expr(node ast.Expr) {
if ifield.has_default_expr {
w.expr(ifield.default_expr)
}
fsym := w.table.get_type_symbol(ifield.typ)
if fsym.kind == .map {
w.table.used_maps++
}
}
}
if node.has_update_expr {
@ -429,6 +433,9 @@ pub fn (mut w Walker) call_expr(mut node ast.CallExpr) {
w.expr(arg.expr)
}
if node.language == .c {
if node.name in ['C.wyhash', 'C.wyhash64'] {
w.table.used_maps++
}
return
}
w.expr(node.left)