@@ -902,20 +902,26 @@ fn gen_js_get_opt(dec_name string, field_type string, styp string, tmp string, n
902
902
}
903
903
904
904
fn js_enc_name (typ string ) string {
905
- suffix := typ.replace ('*' , '_ptr' )
905
+ mut suffix := typ.replace ('*' , '_ptr' )
906
+ if typ == 'i32' {
907
+ suffix = typ.replace ('i32' , 'int' )
908
+ }
906
909
name := 'json__encode_${suffix} '
907
910
return util.no_dots (name)
908
911
}
909
912
910
913
fn js_dec_name (typ string ) string {
911
- suffix := typ.replace ('*' , '_ptr' )
914
+ mut suffix := typ.replace ('*' , '_ptr' )
915
+ if typ == 'i32' {
916
+ suffix = typ.replace ('i32' , 'int' )
917
+ }
912
918
name := 'json__decode_${suffix} '
913
919
return util.no_dots (name)
914
920
}
915
921
916
922
fn is_js_prim (typ string ) bool {
917
- return typ in ['int' , 'rune' , 'string' , 'bool' , 'f32' , 'f64' , 'i8' , 'i16' , 'i64 ' , 'u8 ' , 'u16 ' ,
918
- 'u32' , 'u64' , 'byte' ]
923
+ return typ in ['int' , 'rune' , 'string' , 'bool' , 'f32' , 'f64' , 'i8' , 'i16' , 'i32 ' , 'i64 ' , 'u8 ' ,
924
+ 'u16' , ' u32' , 'u64' , 'byte' ]
919
925
}
920
926
921
927
fn (mut g Gen) decode_array (utyp ast.Type, value_type ast.Type, fixed_array_size int , ret_styp string ) string {
0 commit comments