ci: fix `v build-examples`

master
Delyan Angelov 2022-04-15 20:31:10 +03:00
parent e18cb9748f
commit 6f5a513d8b
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
8 changed files with 16 additions and 17 deletions

View File

@ -84,7 +84,7 @@ fn (_ None__) str() string {
}
pub struct Option {
state byte
state u8
err IError = none__
}

View File

@ -133,7 +133,7 @@ pub fn (x int_literal) hex() string {
return res
}
pub fn (x byte) hex() string {
pub fn (x u8) hex() string {
res := ''
#res.str = x.val.toString(16)
@ -172,7 +172,7 @@ pub fn (i i64) hex2() string {
return '0x' + i.hex()
}
pub fn (i byte) hex2() string {
pub fn (i u8) hex2() string {
return '0x' + i.hex()
}

View File

@ -28,7 +28,7 @@ pub fn (s string) after(dot string) string {
return string(s.str.slice(JS.Number(int(s.str.lastIndexOf(dot.str)) + 1), s.str.length))
}
pub fn (s string) after_char(dot byte) string {
pub fn (s string) after_char(dot u8) string {
// TODO: Implement after byte
return s
}
@ -385,7 +385,7 @@ fn compare_lower_strings(a &string, b &string) int {
// at returns the byte at index `idx`.
// Example: assert 'ABC'.at(1) == u8(`B`)
fn (s string) at(idx int) byte {
fn (s string) at(idx int) u8 {
mut result := u8(0)
#result = new u8(s.str.charCodeAt(result))
@ -491,7 +491,7 @@ pub fn (s string) strip_margin() string {
// strip_margin_custom does the same as `strip_margin` but will use `del` as delimiter instead of `|`
[direct_array_access]
pub fn (s string) strip_margin_custom(del byte) string {
pub fn (s string) strip_margin_custom(del u8) string {
mut sep := del
if sep.is_space() {
eprintln('Warning: `strip_margin` cannot use white-space as a delimiter')

View File

@ -12,6 +12,6 @@ pub fn utf8_str_len(s string) int {
return s.len
}
pub fn utf8_char_len(b byte) int {
pub fn utf8_char_len(b u8) int {
return ((0xe5000000 >> ((b >> 3) & 0x1e)) & 3) + 1
}

View File

@ -162,7 +162,7 @@ fn stmt_binder_match(mut stmt Stmt, data orm.Primitive) {
i64 {
stmt.bind_i64(&data)
}
byte {
u8 {
stmt.bind_u8(&data)
}
u16 {

View File

@ -466,7 +466,7 @@ fn (mut g JsGen) gen_str_for_array(info ast.Array, styp string, str_fn_name stri
is_elem_ptr := typ.is_ptr()
sym_has_str_method, str_method_expects_ptr, _ := sym.str_method_info()
mut elem_str_fn_name := g.get_str_fn(typ)
if sym.kind == .byte {
if sym.kind == .u8 {
elem_str_fn_name = elem_str_fn_name + '_escaped'
}

View File

@ -26,8 +26,7 @@ fn (mut g JsGen) to_js_typ_val(t ast.Type) string {
mut styp := ''
mut prefix := 'new '
match sym.kind {
.i8, .i16, .int, .i64, .byte, .u8, .u16, .u32, .u64, .f32, .f64, .int_literal,
.float_literal {
.i8, .i16, .int, .i64, .u8, .u16, .u32, .u64, .f32, .f64, .int_literal, .float_literal {
styp = '$prefix${g.sym_to_js_typ(sym)}(0)'
}
.bool {
@ -71,8 +70,8 @@ fn (mut g JsGen) sym_to_js_typ(sym ast.TypeSymbol) string {
.i64 {
styp = 'i64'
}
.byte {
styp = 'byte'
.u8 {
styp = 'u8'
}
.u16 {
styp = 'u16'
@ -162,8 +161,8 @@ pub fn (mut g JsGen) doc_typ(t ast.Type) string {
.byteptr, .charptr {
styp = '${g.sym_to_js_typ(sym)}'
}
.i8, .i16, .int, .i64, .isize, .byte, .u8, .u16, .u32, .u64, .usize, .f32, .f64,
.int_literal, .float_literal {
.i8, .i16, .int, .i64, .isize, .u8, .u16, .u32, .u64, .usize, .f32, .f64, .int_literal,
.float_literal {
styp = '${g.sym_to_js_typ(sym)}'
}
.bool {
@ -396,7 +395,7 @@ fn (mut g JsGen) gen_builtin_type_defs() {
)
}
}
'byte' {
'u8' {
g.gen_builtin_prototype(
typ_name: typ_name
default_value: 'new Number(0)'

View File

@ -21,7 +21,7 @@ const (
// used to generate type structs
v_types = ['i8', 'i16', 'int', 'i64', 'byte', 'u16', 'u32', 'u64', 'f32', 'f64',
'int_literal', 'float_literal', 'bool', 'string', 'map', 'array', 'rune', 'any', 'voidptr']
shallow_equatables = [ast.Kind.i8, .i16, .int, .i64, .byte, .u16, .u32, .u64, .f32, .f64,
shallow_equatables = [ast.Kind.i8, .i16, .int, .i64, .u8, .u16, .u32, .u64, .f32, .f64,
.int_literal, .float_literal, .bool, .string]
)