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

parser: warn when fixed-size ArrayInit doesn't have trailing {}. (#6137)

This commit is contained in:
Nick Treleaven
2020-08-16 03:54:05 +01:00
committed by GitHub
parent a02593204f
commit bab5c21224
15 changed files with 27 additions and 28 deletions

View File

@ -130,7 +130,7 @@ pub fn (ctx &Context) text_width(s string) int {
if !ctx.font_inited {
return 0
}
mut buf := [4]f32
mut buf := [4]f32{}
C.fonsTextBounds(ctx.ft.fons, 0, 0, s.str, 0, buf)
return int((buf[2] - buf[0]) / ctx.scale)
}
@ -139,7 +139,7 @@ pub fn (ctx &Context) text_height(s string) int {
if !ctx.font_inited {
return 0
}
mut buf := [4]f32
mut buf := [4]f32{}
C.fonsTextBounds(ctx.ft.fons, 0, 0, s.str, 0, buf)
return int((buf[3] - buf[1]) / ctx.scale)
}
@ -148,7 +148,7 @@ pub fn (ctx &Context) text_size(s string) (int, int) {
if !ctx.font_inited {
return 0,0
}
mut buf := [4]f32
mut buf := [4]f32{}
C.fonsTextBounds(ctx.ft.fons, 0, 0, s.str, 0, buf)
return int((buf[2] - buf[0]) / ctx.scale), int((buf[3] - buf[1]) / ctx.scale)
}