@@ -24,7 +24,7 @@ fn (g &Gen) type_to_fmt1(typ ast.Type) StrIntpType {
24
24
if typ.is_ptr () && (typ.is_int_valptr () || typ.is_float_valptr ()) {
25
25
return .si_s
26
26
} else if sym.kind in [.struct_, .array, .array_fixed, .map , .bool, .enum_, .interface_,
27
- .sum_type, .function, .alias] {
27
+ .sum_type, .function, .alias, .chan ] {
28
28
return .si_s
29
29
} else if sym.kind == .string {
30
30
return .si_s
@@ -43,7 +43,6 @@ fn (g &Gen) type_to_fmt1(typ ast.Type) StrIntpType {
43
43
} else if sym.kind == .i64 {
44
44
return .si_i64
45
45
}
46
-
47
46
return .si_i32
48
47
}
49
48
@@ -186,13 +185,15 @@ fn struct_auto_str_func1(sym &ast.TypeSymbol, field_type ast.Type, fn_name strin
186
185
} else if sym.kind == .function {
187
186
return '${fn_name} ()'
188
187
} else {
188
+ if sym.kind == .chan {
189
+ return '${fn_name} (it.${c_name(field_name)} )'
190
+ }
189
191
mut method_str := 'it.${c_name(field_name)} '
190
192
if sym.kind == .bool {
191
193
method_str + = ' ? _SLIT("true") : _SLIT("false")'
192
194
} else if (field_type.is_int_valptr () || field_type.is_float_valptr ())
193
195
&& field_type.is_ptr () && ! expects_ptr {
194
- // ptr int can be "nil", so this needs to be castet to a string
195
-
196
+ // ptr int can be "nil", so this needs to be casted to a string
196
197
if sym.kind == .f32 {
197
198
return 'str_intp(1, _MOV((StrIntpData[]){
198
199
{_SLIT0, $si_g32_code , {.d_f32 = *$method_str }}
@@ -205,7 +206,6 @@ fn struct_auto_str_func1(sym &ast.TypeSymbol, field_type ast.Type, fn_name strin
205
206
fmt_type := StrIntpType.si_u64
206
207
return 'str_intp(1, _MOV((StrIntpData[]){{_SLIT0, ${u32(fmt_type) | 0xfe00} , {.d_u64 = *$method_str }}}))'
207
208
}
208
-
209
209
fmt_type := StrIntpType.si_i32
210
210
return 'str_intp(1, _MOV((StrIntpData[]){{_SLIT0, ${u32(fmt_type) | 0xfe00} , {.d_i32 = *$method_str }}}))'
211
211
}
0 commit comments