vdoc: show map type correctly

pull/3988/head
yuyi 2020-03-11 12:18:20 +08:00 committed by GitHub
parent b9955aee84
commit 9e14850bbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -433,7 +433,14 @@ pub fn (table &Table) type_to_str(t Type) string {
res += ')' res += ')'
return res return res
} }
mut res := sym.name.replace('array_', '[]')
mut res := sym.name
if sym.kind == .array {
res = res.replace('array_', '[]')
}
else if sym.kind == .map {
res = res.replace('map_string_', 'map[string]')
}
// mod.submod.submod2.Type => submod2.Type // mod.submod.submod2.Type => submod2.Type
if res.contains('.') { if res.contains('.') {
vals := res.split('.') vals := res.split('.')