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

module cache fixes; do not allow function names starting with _

This commit is contained in:
Alexander Medvednikov
2019-10-09 23:38:33 +03:00
parent 0796e1dd69
commit 2411b8d1e7
18 changed files with 95 additions and 42 deletions

View File

@@ -125,6 +125,15 @@ fn (m mut map) _set(key string, val voidptr) {
m.insert(mut m.root, key, val)
}
fn (m mut map) set(key string, val voidptr) {
if isnil(m.root) {
m.root = new_node(key, val, m.element_size)
m.size++
return
}
m.insert(mut m.root, key, val)
}
/*
fn (m map) bs(query string, start, end int, out voidptr) {
// println('bs "$query" $start -> $end')
@@ -210,8 +219,8 @@ pub fn (m mut map) delete(key string) {
m.size--
}
pub fn (m map) exists(key string) {
panic('map.exists(key) was removed from the language. Use `key in map` instead.')
fn (m map) exists(key string) bool {
return !isnil(m.root) && m.root.find2(key, m.element_size)
}
fn (m map) _exists(key string) bool {