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

fmt: optionals; none

This commit is contained in:
Alexander Medvednikov
2020-02-21 17:52:20 +01:00
parent d075be73e8
commit 9e6773cba8
4 changed files with 15 additions and 4 deletions

View File

@@ -395,5 +395,9 @@ pub mut:
pub fn (table &Table) type_to_str(t Type) string {
sym := table.get_type_symbol(t)
return sym.name.replace('array_', '[]')
mut res := sym.name.replace('array_', '[]')
if type_is_optional(t) {
res = '?' + res
}
return res
}