fmt: stop mangling reference names
parent
c3ddaf16ec
commit
332d52f459
|
@ -453,7 +453,13 @@ fn (f mut Fmt) struct_decl(node ast.StructDecl) {
|
|||
}
|
||||
|
||||
fn (f &Fmt) type_to_str(t table.Type) string {
|
||||
res := f.table.type_to_str(t)
|
||||
mut res := f.table.type_to_str(t)
|
||||
// type_ptr => &type
|
||||
if res.ends_with('_ptr') {
|
||||
res = res[0 .. res.len-4]
|
||||
start_pos := 2 * res.count('[]')
|
||||
res = res[0 .. start_pos] + '&' + res[start_pos .. res.len]
|
||||
}
|
||||
return res.replace(f.cur_mod + '.', '')
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
const (
|
||||
x = &Test{}
|
||||
y = []&Test
|
||||
z = &[]&Test
|
||||
)
|
||||
|
||||
fn test_type_ptr() {
|
||||
a := &Test{}
|
||||
b := []&Test
|
||||
c := &[]&Test
|
||||
}
|
||||
|
||||
struct Test {
|
||||
}
|
Loading…
Reference in New Issue