builtin: fix m.len to 0, after calling map.clear() (#16720)

This commit is contained in:
yuyi 2022-12-23 03:36:33 +08:00 committed by GitHub
parent f9043c84a7
commit e01dac885c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View file

@ -299,6 +299,7 @@ pub fn (mut m map) move() map {
// Example: a.clear() // `a.len` and `a.key_values.len` is now 0
pub fn (mut m map) clear() {
m.len = 0
m.even_index = 0
m.key_values.len = 0
}