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

all: change f mut Foo to mut f Foo

This commit is contained in:
yuyi
2020-06-04 16:35:40 +08:00
committed by GitHub
parent 0b7fe0a9d0
commit 5ae8853648
36 changed files with 62 additions and 65 deletions

View File

@@ -311,7 +311,7 @@ fn test_fixed() {
assert nums2[c_n - 1] == 0
}
fn modify(numbers mut []int) {
fn modify(mut numbers []int) {
numbers[0] = 777
}
@@ -328,13 +328,13 @@ fn test_mut_slice() {
*/
}
fn double_up(a mut []int) {
fn double_up(mut a []int) {
for i := 0; i < a.len; i++ {
a[i] = a[i]*2
}
}
fn double_up_v2(a mut []int) {
fn double_up_v2(mut a []int) {
for i, _ in a {
a[i] = a[i]*2 // or val*2, doesn't matter
}

View File

@@ -160,7 +160,7 @@ fn test_string_arr() {
assert m['a'][1] == 'two'
}
fn mut_map(m mut map[string]int) {
fn mut_map(mut m map[string]int) {
m['a'] = 10
}

View File

@@ -112,7 +112,7 @@ fn (mut m SortedMap) set(key string, value voidptr) {
}
}
fn (mut n mapnode) split_child(child_index int, y mut mapnode) {
fn (mut n mapnode) split_child(child_index int, mut y mapnode) {
mut z := new_node()
z.size = mid_index
y.size = mid_index
@@ -353,7 +353,7 @@ pub fn (mut m SortedMap) delete(key string) {
// Insert all keys of the subtree into array `keys`
// starting at `at`. Keys are inserted in order.
fn (n &mapnode) subkeys(keys mut []string, at int) int {
fn (n &mapnode) subkeys(mut keys []string, at int) int {
mut position := at
if !isnil(n.children) {
// Traverse children and insert