From b81f615a75fdc91542ecf531633787a5bc9321ab Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 28 Jun 2019 15:55:18 +0200 Subject: [PATCH] parser.v: string interpolation for pointers --- compiler/parser.v | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/parser.v b/compiler/parser.v index 33878466cf..a0c28a7425 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -2088,11 +2088,14 @@ fn (p mut Parser) typ_to_fmt(typ string) string { case 'u32': return '%d' case 'f64', 'f32': return '%f' case 'i64': return '%lld' - case 'byte*': return '%s' + case 'byte*', 'byteptr': return '%s' // case 'array_string': return '%s' // case 'array_int': return '%s' case 'void': p.error('cannot interpolate this value') default: + if typ.ends_with('*') { + return '%p' + } p.error('unhandled sprintf format "$typ" ') } return ''