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

@ -407,15 +407,14 @@ pub fn (t &Table) known_type(name string) bool {
[inline]
pub fn (t &Table) array_name(elem_type Type, nr_dims int) string {
elem_type_sym := t.get_type_symbol(elem_type)
return 'array_$elem_type_sym.name' + if elem_type.is_ptr() {
'_ptr'.repeat(elem_type.nr_muls())
} else {
''
} + if nr_dims > 1 {
'_${nr_dims}d'
} else {
''
mut res := ''
if elem_type.is_ptr() {
res = '_ptr'.repeat(elem_type.nr_muls())
}
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.
@ -430,15 +429,14 @@ pub fn (t &Table) array_source_name(elem_type Type) string {
[inline]
pub fn (t &Table) array_fixed_name(elem_type Type, size, nr_dims int) string {
elem_type_sym := t.get_type_symbol(elem_type)
return 'array_fixed_${elem_type_sym.name}_$size' + if elem_type.is_ptr() {
'_ptr'
} else {
''
} + if nr_dims > 1 {
'_${nr_dims}d'
} else {
''
mut res := ''
if elem_type.is_ptr() {
res = '_ptr'
}
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.