@@ -902,20 +902,26 @@ fn gen_js_get_opt(dec_name string, field_type string, styp string, tmp string, n
902902}
903903
904904fn 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+ }
906909 name := 'json__encode_${suffix} '
907910 return util.no_dots (name)
908911}
909912
910913fn 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+ }
912918 name := 'json__decode_${suffix} '
913919 return util.no_dots (name)
914920}
915921
916922fn 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' ]
919925}
920926
921927fn (mut g Gen) decode_array (utyp ast.Type, value_type ast.Type, fixed_array_size int , ret_styp string ) string {
0 commit comments