From c5884a5f4dae86840c02fe13249865f2db12a8ba Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 19 Mar 2021 20:56:49 +0200 Subject: [PATCH] v.ast: improve Expr.str() for `sizeof(Type)` --- vlib/v/ast/str.v | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vlib/v/ast/str.v b/vlib/v/ast/str.v index 38a561478e..06f65598b7 100644 --- a/vlib/v/ast/str.v +++ b/vlib/v/ast/str.v @@ -318,6 +318,9 @@ pub fn (x Expr) str() string { return '${x.expr.str()}.$x.field_name' } SizeOf { + if x.is_type { + return 'sizeof(Type($x.typ))' + } return 'sizeof($x.expr)' } OffsetOf {