mirror of
https://github.com/vlang/v.git
synced 2025-09-18 03:46:36 -04:00
all: new int fixes
This commit is contained in:
parent
05d940ac2a
commit
4f85b49bb5
@ -115,7 +115,7 @@ mut:
|
||||
// gg context for drawing
|
||||
gg &gg.Context = unsafe { nil }
|
||||
font_loaded bool
|
||||
show_ghost bool = true
|
||||
show_ghost bool
|
||||
// frame/time counters:
|
||||
frame int
|
||||
frame_old int
|
||||
@ -159,9 +159,7 @@ fn frame(mut game Game) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut game := &Game{
|
||||
gg: 0
|
||||
}
|
||||
mut game := &Game{}
|
||||
mut fpath := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf'))
|
||||
$if android {
|
||||
fpath = 'fonts/RobotoMono-Regular.ttf'
|
||||
@ -322,7 +320,6 @@ fn (mut g Game) get_tetro() {
|
||||
g.tetro = g.tetros_cache[idx..idx + tetro_size].clone()
|
||||
}
|
||||
|
||||
// TODO mut
|
||||
fn (mut g Game) drop_tetro() {
|
||||
for i in 0 .. tetro_size {
|
||||
tetro := g.tetro[i]
|
||||
|
@ -7,6 +7,7 @@ pub type ComptTimeConstValue = EmptyExpr
|
||||
| i32
|
||||
| i64
|
||||
| i8
|
||||
| int
|
||||
| rune
|
||||
| string
|
||||
| u16
|
||||
@ -55,7 +56,7 @@ pub fn (val ComptTimeConstValue) i32() ?i32 {
|
||||
|
||||
pub fn (val ComptTimeConstValue) voidptr() ?voidptr {
|
||||
match val {
|
||||
i8, i16, i32, i64 { return voidptr(i64(val)) }
|
||||
i8, i16, i32, i64, int { return voidptr(i64(val)) }
|
||||
u8, u16, u32, u64 { return voidptr(u64(val)) }
|
||||
rune { return voidptr(u64(val)) }
|
||||
voidptr { return val }
|
||||
@ -75,7 +76,7 @@ pub fn (val ComptTimeConstValue) i64() ?i64 {
|
||||
i32 {
|
||||
return i64(val)
|
||||
}
|
||||
i64 {
|
||||
i64, int {
|
||||
return i64(val)
|
||||
}
|
||||
u8 {
|
||||
@ -164,6 +165,11 @@ pub fn (val ComptTimeConstValue) u64() ?u64 {
|
||||
return u64(val)
|
||||
}
|
||||
}
|
||||
int {
|
||||
if val >= 0 {
|
||||
return u64(val)
|
||||
}
|
||||
}
|
||||
u8 {
|
||||
return u64(val)
|
||||
}
|
||||
@ -217,6 +223,9 @@ pub fn (val ComptTimeConstValue) f64() ?f64 {
|
||||
i64 {
|
||||
return f64(val)
|
||||
}
|
||||
int {
|
||||
return f64(val)
|
||||
}
|
||||
u8 {
|
||||
return f64(val)
|
||||
}
|
||||
@ -259,6 +268,9 @@ pub fn (val ComptTimeConstValue) string() ?string {
|
||||
i64 {
|
||||
return val.str()
|
||||
}
|
||||
int {
|
||||
return val.str()
|
||||
}
|
||||
u8 {
|
||||
return val.str()
|
||||
}
|
||||
|
@ -46,6 +46,13 @@ vlib/v/checker/tests/compare_unsigned_signed.vv:20:13: error: `int` cannot be co
|
||||
| ~~
|
||||
21 | _ = i32(0) == u64(0) // FIXME
|
||||
22 | // swap order
|
||||
vlib/v/checker/tests/compare_unsigned_signed.vv:21:13: error: `i32` cannot be compared with `u64`
|
||||
19 | _ = i16(0) != u32(0)
|
||||
20 | _ = int(0) == u64(0)
|
||||
21 | _ = i32(0) == u64(0) // FIXME
|
||||
| ~~
|
||||
22 | // swap order
|
||||
23 | _ = u16(0) == i8(0)
|
||||
vlib/v/checker/tests/compare_unsigned_signed.vv:23:13: error: `u16` cannot be compared with `i8`
|
||||
21 | _ = i32(0) == u64(0) // FIXME
|
||||
22 | // swap order
|
||||
|
@ -5390,6 +5390,10 @@ fn (mut g Gen) const_decl_precomputed(mod string, name string, field_name string
|
||||
i32 {
|
||||
g.const_decl_write_precomputed(mod, styp, cname, field_name, ct_value.str())
|
||||
}
|
||||
int {
|
||||
// XTODO int64
|
||||
g.const_decl_write_precomputed(mod, styp, cname, field_name, ct_value.str())
|
||||
}
|
||||
i64 {
|
||||
if typ == ast.i64_type {
|
||||
return false
|
||||
|
Loading…
x
Reference in New Issue
Block a user