mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: support non-string map.keys method (#7760)
This commit is contained in:
@ -646,7 +646,7 @@ pub fn (m &map) keys() []string {
|
||||
}
|
||||
|
||||
// Returns all keys in the map.
|
||||
pub fn (m &map) keys_1() array {
|
||||
fn (m &map) keys_1() array {
|
||||
mut keys := __new_array(m.len, 0, m.key_bytes)
|
||||
mut item := unsafe { byteptr(keys.data) }
|
||||
if m.key_values.deletes == 0 {
|
||||
@ -674,7 +674,7 @@ pub fn (m &map) keys_1() array {
|
||||
|
||||
// warning: only copies keys, does not clone
|
||||
[unsafe]
|
||||
pub fn (d &DenseArray) clone() DenseArray {
|
||||
fn (d &DenseArray) clone() DenseArray {
|
||||
res := DenseArray{
|
||||
key_bytes: d.key_bytes
|
||||
value_bytes: d.value_bytes
|
||||
|
@ -492,6 +492,7 @@ fn test_int_keys() {
|
||||
same := mc == m
|
||||
assert same
|
||||
assert mc.len == 3
|
||||
assert mc.keys() == [3,4,5]
|
||||
mut all := []int{}
|
||||
for k, v in mc {
|
||||
assert m[k] == v
|
||||
|
Reference in New Issue
Block a user