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

pull/6548/head
Delyan Angelov 2020-10-03 12:57:15 +03:00
parent 677b0ba2d2
commit de77f0ba0f
1 changed files with 18 additions and 20 deletions

View File

@ -406,16 +406,15 @@ 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 { if nr_dims > 1 {
'_${nr_dims}d' res += '_${nr_dims}d'
} else { }
'' 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.
@ -429,16 +428,15 @@ 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 { if nr_dims > 1 {
'_${nr_dims}d' res += '_${nr_dims}d'
} else { }
'' 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.