ci: fix `v build-examples`
parent
e18cb9748f
commit
6f5a513d8b
|
@ -84,7 +84,7 @@ fn (_ None__) str() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Option {
|
pub struct Option {
|
||||||
state byte
|
state u8
|
||||||
err IError = none__
|
err IError = none__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ pub fn (x int_literal) hex() string {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (x byte) hex() string {
|
pub fn (x u8) hex() string {
|
||||||
res := ''
|
res := ''
|
||||||
#res.str = x.val.toString(16)
|
#res.str = x.val.toString(16)
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ pub fn (i i64) hex2() string {
|
||||||
return '0x' + i.hex()
|
return '0x' + i.hex()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (i byte) hex2() string {
|
pub fn (i u8) hex2() string {
|
||||||
return '0x' + i.hex()
|
return '0x' + i.hex()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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))
|
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
|
// TODO: Implement after byte
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ fn compare_lower_strings(a &string, b &string) int {
|
||||||
|
|
||||||
// at returns the byte at index `idx`.
|
// at returns the byte at index `idx`.
|
||||||
// Example: assert 'ABC'.at(1) == u8(`B`)
|
// 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)
|
mut result := u8(0)
|
||||||
#result = new u8(s.str.charCodeAt(result))
|
#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 `|`
|
// strip_margin_custom does the same as `strip_margin` but will use `del` as delimiter instead of `|`
|
||||||
[direct_array_access]
|
[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
|
mut sep := del
|
||||||
if sep.is_space() {
|
if sep.is_space() {
|
||||||
eprintln('Warning: `strip_margin` cannot use white-space as a delimiter')
|
eprintln('Warning: `strip_margin` cannot use white-space as a delimiter')
|
||||||
|
|
|
@ -12,6 +12,6 @@ pub fn utf8_str_len(s string) int {
|
||||||
return s.len
|
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
|
return ((0xe5000000 >> ((b >> 3) & 0x1e)) & 3) + 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ fn stmt_binder_match(mut stmt Stmt, data orm.Primitive) {
|
||||||
i64 {
|
i64 {
|
||||||
stmt.bind_i64(&data)
|
stmt.bind_i64(&data)
|
||||||
}
|
}
|
||||||
byte {
|
u8 {
|
||||||
stmt.bind_u8(&data)
|
stmt.bind_u8(&data)
|
||||||
}
|
}
|
||||||
u16 {
|
u16 {
|
||||||
|
|
|
@ -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()
|
is_elem_ptr := typ.is_ptr()
|
||||||
sym_has_str_method, str_method_expects_ptr, _ := sym.str_method_info()
|
sym_has_str_method, str_method_expects_ptr, _ := sym.str_method_info()
|
||||||
mut elem_str_fn_name := g.get_str_fn(typ)
|
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'
|
elem_str_fn_name = elem_str_fn_name + '_escaped'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@ fn (mut g JsGen) to_js_typ_val(t ast.Type) string {
|
||||||
mut styp := ''
|
mut styp := ''
|
||||||
mut prefix := 'new '
|
mut prefix := 'new '
|
||||||
match sym.kind {
|
match sym.kind {
|
||||||
.i8, .i16, .int, .i64, .byte, .u8, .u16, .u32, .u64, .f32, .f64, .int_literal,
|
.i8, .i16, .int, .i64, .u8, .u16, .u32, .u64, .f32, .f64, .int_literal, .float_literal {
|
||||||
.float_literal {
|
|
||||||
styp = '$prefix${g.sym_to_js_typ(sym)}(0)'
|
styp = '$prefix${g.sym_to_js_typ(sym)}(0)'
|
||||||
}
|
}
|
||||||
.bool {
|
.bool {
|
||||||
|
@ -71,8 +70,8 @@ fn (mut g JsGen) sym_to_js_typ(sym ast.TypeSymbol) string {
|
||||||
.i64 {
|
.i64 {
|
||||||
styp = 'i64'
|
styp = 'i64'
|
||||||
}
|
}
|
||||||
.byte {
|
.u8 {
|
||||||
styp = 'byte'
|
styp = 'u8'
|
||||||
}
|
}
|
||||||
.u16 {
|
.u16 {
|
||||||
styp = 'u16'
|
styp = 'u16'
|
||||||
|
@ -162,8 +161,8 @@ pub fn (mut g JsGen) doc_typ(t ast.Type) string {
|
||||||
.byteptr, .charptr {
|
.byteptr, .charptr {
|
||||||
styp = '${g.sym_to_js_typ(sym)}'
|
styp = '${g.sym_to_js_typ(sym)}'
|
||||||
}
|
}
|
||||||
.i8, .i16, .int, .i64, .isize, .byte, .u8, .u16, .u32, .u64, .usize, .f32, .f64,
|
.i8, .i16, .int, .i64, .isize, .u8, .u16, .u32, .u64, .usize, .f32, .f64, .int_literal,
|
||||||
.int_literal, .float_literal {
|
.float_literal {
|
||||||
styp = '${g.sym_to_js_typ(sym)}'
|
styp = '${g.sym_to_js_typ(sym)}'
|
||||||
}
|
}
|
||||||
.bool {
|
.bool {
|
||||||
|
@ -396,7 +395,7 @@ fn (mut g JsGen) gen_builtin_type_defs() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'byte' {
|
'u8' {
|
||||||
g.gen_builtin_prototype(
|
g.gen_builtin_prototype(
|
||||||
typ_name: typ_name
|
typ_name: typ_name
|
||||||
default_value: 'new Number(0)'
|
default_value: 'new Number(0)'
|
||||||
|
|
|
@ -21,7 +21,7 @@ const (
|
||||||
// used to generate type structs
|
// used to generate type structs
|
||||||
v_types = ['i8', 'i16', 'int', 'i64', 'byte', 'u16', 'u32', 'u64', 'f32', 'f64',
|
v_types = ['i8', 'i16', 'int', 'i64', 'byte', 'u16', 'u32', 'u64', 'f32', 'f64',
|
||||||
'int_literal', 'float_literal', 'bool', 'string', 'map', 'array', 'rune', 'any', 'voidptr']
|
'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]
|
.int_literal, .float_literal, .bool, .string]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue