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

all: simplify return if ... constructs to make more code compatible with -autofree

This commit is contained in:
Delyan Angelov
2021-03-22 16:45:29 +02:00
parent a53aaaf9e7
commit c76c69ec35
9 changed files with 129 additions and 71 deletions

View File

@@ -1262,7 +1262,10 @@ fn (mut s Scanner) ident_char() string {
}
}
// Escapes a `'` character
return if c == "'" { '\\' + c } else { c }
if c == "'" {
return '\\' + c
}
return c
}
[inline]

View File

@@ -705,11 +705,10 @@ pub fn (mut t Table) find_or_register_array(elem_type Type) int {
}
pub fn (mut t Table) find_or_register_array_with_dims(elem_type Type, nr_dims int) int {
return if nr_dims == 1 {
t.find_or_register_array(elem_type)
} else {
t.find_or_register_array(t.find_or_register_array_with_dims(elem_type, nr_dims - 1))
if nr_dims == 1 {
return t.find_or_register_array(elem_type)
}
return t.find_or_register_array(t.find_or_register_array_with_dims(elem_type, nr_dims - 1))
}
pub fn (mut t Table) find_or_register_array_fixed(elem_type Type, size int) int {