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

vfmt: make vlib/v/table/table.v vfmt-able

This commit is contained in:
Delyan Angelov 2020-10-03 12:57:15 +03:00
parent 677b0ba2d2
commit de77f0ba0f

View File

@ -407,15 +407,14 @@ pub fn (t &Table) known_type(name string) bool {
[inline] [inline]
pub fn (t &Table) array_name(elem_type Type, nr_dims int) string { pub fn (t &Table) array_name(elem_type Type, nr_dims int) string {
elem_type_sym := t.get_type_symbol(elem_type) elem_type_sym := t.get_type_symbol(elem_type)
return 'array_$elem_type_sym.name' + if elem_type.is_ptr() { mut res := ''
'_ptr'.repeat(elem_type.nr_muls()) if elem_type.is_ptr() {
} else { res = '_ptr'.repeat(elem_type.nr_muls())
''
} + if nr_dims > 1 {
'_${nr_dims}d'
} else {
''
} }
if nr_dims > 1 {
res += '_${nr_dims}d'
}
return 'array_$elem_type_sym.name' + res
} }
// array_source_name generates the original name for the v source. // array_source_name generates the original name for the v source.
@ -430,15 +429,14 @@ pub fn (t &Table) array_source_name(elem_type Type) string {
[inline] [inline]
pub fn (t &Table) array_fixed_name(elem_type Type, size, nr_dims int) string { pub fn (t &Table) array_fixed_name(elem_type Type, size, nr_dims int) string {
elem_type_sym := t.get_type_symbol(elem_type) elem_type_sym := t.get_type_symbol(elem_type)
return 'array_fixed_${elem_type_sym.name}_$size' + if elem_type.is_ptr() { mut res := ''
'_ptr' if elem_type.is_ptr() {
} else { res = '_ptr'
''
} + if nr_dims > 1 {
'_${nr_dims}d'
} else {
''
} }
if nr_dims > 1 {
res += '_${nr_dims}d'
}
return 'array_fixed_${elem_type_sym.name}_$size' + res
} }
// array_fixed_source_name generates the original name for the v source. // array_fixed_source_name generates the original name for the v source.