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

map: rename size to len

This commit is contained in:
ka-weihe
2020-06-21 16:51:02 +02:00
committed by GitHub
parent fbe5599526
commit 7f225f2eaa
10 changed files with 116 additions and 116 deletions

View File

@@ -11,7 +11,7 @@ pub mut:
struct Values {
pub mut:
data map[string]Value
size int
len int
}
// new_values returns a new Values struct for creating
@@ -35,7 +35,7 @@ pub fn (v &Value) all() []string {
// If there are no values associated with the key, get returns
// a empty string.
pub fn (v &Values) get(key string) string {
if v.data.size == 0 {
if v.data.len == 0 {
return ''
}
vs := v.data[key]
@@ -49,7 +49,7 @@ pub fn (v &Values) get(key string) string {
// If there are no values associated with the key, get returns
// a empty []string.
pub fn (v &Values) get_all(key string) []string {
if v.data.size == 0 {
if v.data.len == 0 {
return []
}
vs := v.data[key]
@@ -65,7 +65,7 @@ pub fn (mut v Values) set(key, value string) {
mut a := v.data[key]
a.data = [value]
v.data[key] = a
v.size = v.data.size
v.len = v.data.len
}
// add adds the value to key. It appends to any existing
@@ -77,11 +77,11 @@ pub fn (mut v Values) add(key, value string) {
}
a.data << value
v.data[key] = a
v.size = v.data.size
v.len = v.data.len
}
// del deletes the values associated with key.
pub fn (mut v Values) del(key string) {
v.data.delete(key)
v.size = v.data.size
v.len = v.data.len
}