v.ast: improve Expr.str() for `sizeof(Type)`

pull/9379/head
Delyan Angelov 2021-03-19 20:56:49 +02:00
parent 79a8e34e33
commit c5884a5f4d
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 3 additions and 0 deletions

View File

@ -318,6 +318,9 @@ pub fn (x Expr) str() string {
return '${x.expr.str()}.$x.field_name' return '${x.expr.str()}.$x.field_name'
} }
SizeOf { SizeOf {
if x.is_type {
return 'sizeof(Type($x.typ))'
}
return 'sizeof($x.expr)' return 'sizeof($x.expr)'
} }
OffsetOf { OffsetOf {