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

parser.v: string interpolation for pointers

This commit is contained in:
Alexander Medvednikov 2019-06-28 15:55:18 +02:00
parent 8abc461a55
commit b81f615a75

View File

@ -2088,11 +2088,14 @@ fn (p mut Parser) typ_to_fmt(typ string) string {
case 'u32': return '%d' case 'u32': return '%d'
case 'f64', 'f32': return '%f' case 'f64', 'f32': return '%f'
case 'i64': return '%lld' case 'i64': return '%lld'
case 'byte*': return '%s' case 'byte*', 'byteptr': return '%s'
// case 'array_string': return '%s' // case 'array_string': return '%s'
// case 'array_int': return '%s' // case 'array_int': return '%s'
case 'void': p.error('cannot interpolate this value') case 'void': p.error('cannot interpolate this value')
default: default:
if typ.ends_with('*') {
return '%p'
}
p.error('unhandled sprintf format "$typ" ') p.error('unhandled sprintf format "$typ" ')
} }
return '' return ''