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

map: fix in for deleted keys

This commit is contained in:
Alexander Medvednikov
2019-11-22 20:05:27 +03:00
parent 39adc984a8
commit 57fbf0b8a9
2 changed files with 13 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ pub:
struct mapnode {
left &mapnode
right &mapnode
is_empty bool
is_empty bool // set by delete()
key string
val voidptr
}
@@ -97,7 +97,7 @@ fn (n & mapnode) find(key string, out voidptr, element_size int) bool{
// same as `find`, but doesn't return a value. Used by `exists`
fn (n & mapnode) find2(key string, element_size int) bool{
if n.key == key {
if n.key == key && !n.is_empty {
return true
}
else if n.key > key {