@@ -107,7 +107,7 @@ fn (mut g Gen) gen_str_default(sym ast.TypeSymbol, styp string, str_fn_name stri
107107 } else {
108108 verror ('could not generate string method for type `$styp `' )
109109 }
110- g.type_definitions .writeln ('string ${str_fn_name} ($styp it); // auto' )
110+ g.definitions .writeln ('string ${str_fn_name} ($styp it); // auto' )
111111 g.auto_str_funcs.writeln ('string ${str_fn_name} ($styp it) {' )
112112 if convertor == 'bool' {
113113 g.auto_str_funcs.writeln ('\t string tmp1 = string__plus(_SLIT("${styp} ("), ($convertor )it ? _SLIT("true") : _SLIT("false"));' )
@@ -234,9 +234,9 @@ fn (mut g Gen) gen_str_for_option(typ ast.Type, styp string, str_fn_name string)
234234 sym_has_str_method , _ , _ := sym.str_method_info ()
235235 parent_str_fn_name := g.get_str_fn (parent_type)
236236
237- g.type_definitions .writeln ('string ${str_fn_name} ($styp it); // auto' )
237+ g.definitions .writeln ('string ${str_fn_name} ($styp it); // auto' )
238238 g.auto_str_funcs.writeln ('string ${str_fn_name} ($styp it) { return indent_${str_fn_name} (it, 0); }' )
239- g.type_definitions .writeln ('string indent_${str_fn_name} ($styp it, int indent_count); // auto' )
239+ g.definitions .writeln ('string indent_${str_fn_name} ($styp it, int indent_count); // auto' )
240240 g.auto_str_funcs.writeln ('string indent_${str_fn_name} ($styp it, int indent_count) {' )
241241 g.auto_str_funcs.writeln ('\t string res;' )
242242 g.auto_str_funcs.writeln ('\t if (it.state == 0) {' )
@@ -264,9 +264,9 @@ fn (mut g Gen) gen_str_for_alias(info ast.Alias, styp string, str_fn_name string
264264 eprintln ('> gen_str_for_alias: $parent_str_fn_name | $styp | $str_fn_name ' )
265265 }
266266 mut clean_type_v_type_name := util.strip_main_name (styp.replace ('__' , '.' ))
267- g.type_definitions .writeln ('static string ${str_fn_name} ($styp it); // auto' )
267+ g.definitions .writeln ('static string ${str_fn_name} ($styp it); // auto' )
268268 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp it) { return indent_${str_fn_name} (it, 0); }' )
269- g.type_definitions .writeln ('static string indent_${str_fn_name} ($styp it, int indent_count); // auto' )
269+ g.definitions .writeln ('static string indent_${str_fn_name} ($styp it, int indent_count); // auto' )
270270 g.auto_str_funcs.writeln ('static string indent_${str_fn_name} ($styp it, int indent_count) {' )
271271 g.auto_str_funcs.writeln ('\t string indents = string_repeat(_SLIT(" "), indent_count);' )
272272 g.auto_str_funcs.writeln ('\t string tmp_ds = ${parent_str_fn_name} (it);' )
@@ -285,7 +285,7 @@ fn (mut g Gen) gen_str_for_multi_return(info ast.MultiReturn, styp string, str_f
285285 $if trace_autostr ? {
286286 eprintln ('> gen_str_for_multi_return: $info.types | $styp | $str_fn_name ' )
287287 }
288- g.type_definitions .writeln ('static string ${str_fn_name} ($styp a); // auto' )
288+ g.definitions .writeln ('static string ${str_fn_name} ($styp a); // auto' )
289289 mut fn_builder := strings.new_builder (512 )
290290 fn_builder.writeln ('static string ${str_fn_name} ($styp a) {' )
291291 fn_builder.writeln ('\t strings__Builder sb = strings__new_builder($info.types.len * 10);' )
@@ -333,7 +333,7 @@ fn (mut g Gen) gen_str_for_enum(info ast.Enum, styp string, str_fn_name string)
333333 eprintln ('> gen_str_for_enum: $info | $styp | $str_fn_name ' )
334334 }
335335 s := util.no_dots (styp)
336- g.type_definitions .writeln ('static string ${str_fn_name} ($styp it); // auto' )
336+ g.definitions .writeln ('static string ${str_fn_name} ($styp it); // auto' )
337337 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp it) { /* gen_str_for_enum */' )
338338 // Enums tagged with `[flag]` are special in that they can be a combination of enum values
339339 if info.is_flag {
@@ -368,9 +368,9 @@ fn (mut g Gen) gen_str_for_interface(info ast.Interface, styp string, str_fn_nam
368368 eprintln ('> gen_str_for_interface: $info.types | $styp | $str_fn_name ' )
369369 }
370370 // _str() functions should have a single argument, the indenting ones take 2:
371- g.type_definitions .writeln ('static string ${str_fn_name} ($styp x); // auto' )
371+ g.definitions .writeln ('static string ${str_fn_name} ($styp x); // auto' )
372372 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp x) { return indent_${str_fn_name} (x, 0); }' )
373- g.type_definitions .writeln ('static string indent_${str_fn_name} ($styp x, int indent_count); // auto' )
373+ g.definitions .writeln ('static string indent_${str_fn_name} ($styp x, int indent_count); // auto' )
374374 mut fn_builder := strings.new_builder (512 )
375375 mut clean_interface_v_type_name := styp.replace ('__' , '.' )
376376 if styp.ends_with ('*' ) {
@@ -429,9 +429,9 @@ fn (mut g Gen) gen_str_for_union_sum_type(info ast.SumType, styp string, str_fn_
429429 eprintln ('> gen_str_for_union_sum_type: $info.variants | $styp | $str_fn_name ' )
430430 }
431431 // _str() functions should have a single argument, the indenting ones take 2:
432- g.type_definitions .writeln ('static string ${str_fn_name} ($styp x); // auto' )
432+ g.definitions .writeln ('static string ${str_fn_name} ($styp x); // auto' )
433433 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp x) { return indent_${str_fn_name} (x, 0); }' )
434- g.type_definitions .writeln ('static string indent_${str_fn_name} ($styp x, int indent_count); // auto' )
434+ g.definitions .writeln ('static string indent_${str_fn_name} ($styp x, int indent_count); // auto' )
435435 mut fn_builder := strings.new_builder (512 )
436436 fn_builder.writeln ('static string indent_${str_fn_name} ($styp x, int indent_count) {' )
437437 mut clean_sum_type_v_type_name := ''
@@ -521,7 +521,7 @@ fn (mut g Gen) gen_str_for_fn_type(info ast.FnType, styp string, str_fn_name str
521521 $if trace_autostr ? {
522522 eprintln ('> gen_str_for_fn_type: $info.func.name | $styp | $str_fn_name ' )
523523 }
524- g.type_definitions .writeln ('static string ${str_fn_name} (); // auto' )
524+ g.definitions .writeln ('static string ${str_fn_name} (); // auto' )
525525 g.auto_str_funcs.writeln ('static string ${str_fn_name} () { return _SLIT("${g.fn_decl_str(info)} ");}' )
526526}
527527
@@ -530,7 +530,7 @@ fn (mut g Gen) gen_str_for_chan(info ast.Chan, styp string, str_fn_name string)
530530 eprintln ('> gen_str_for_chan: $info.elem_type.debug () | $styp | $str_fn_name ' )
531531 }
532532 elem_type_name := util.strip_main_name (g.table.get_type_name (g.unwrap_generic (info.elem_type)))
533- g.type_definitions .writeln ('static string ${str_fn_name} ($styp x); // auto' )
533+ g.definitions .writeln ('static string ${str_fn_name} ($styp x); // auto' )
534534 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp x) { return sync__Channel_auto_str(x, _SLIT("$elem_type_name ")); }' )
535535}
536536
@@ -539,7 +539,7 @@ fn (mut g Gen) gen_str_for_thread(info ast.Thread, styp string, str_fn_name stri
539539 eprintln ('> gen_str_for_thread: $info.return_type.debug () | $styp | $str_fn_name ' )
540540 }
541541 ret_type_name := util.strip_main_name (g.table.get_type_name (info.return_type))
542- g.type_definitions .writeln ('static string ${str_fn_name} ($styp _); // auto}' )
542+ g.definitions .writeln ('static string ${str_fn_name} ($styp _); // auto}' )
543543 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp _) { return _SLIT("thread($ret_type_name )");}' )
544544}
545545
@@ -578,9 +578,9 @@ fn (mut g Gen) gen_str_for_array(info ast.Array, styp string, str_fn_name string
578578 elem_str_fn_name = elem_str_fn_name + '_escaped'
579579 }
580580
581- g.type_definitions .writeln ('static string ${str_fn_name} ($styp a); // auto' )
581+ g.definitions .writeln ('static string ${str_fn_name} ($styp a); // auto' )
582582 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp a) { return indent_${str_fn_name} (a, 0);}' )
583- g.type_definitions .writeln ('static string indent_${str_fn_name} ($styp a, int indent_count); // auto' )
583+ g.definitions .writeln ('static string indent_${str_fn_name} ($styp a, int indent_count); // auto' )
584584 g.auto_str_funcs.writeln ('static string indent_${str_fn_name} ($styp a, int indent_count) {' )
585585 g.auto_str_funcs.writeln ('\t strings__Builder sb = strings__new_builder(a.len * 10);' )
586586 g.auto_str_funcs.writeln ('\t strings__Builder_write_string(&sb, _SLIT("["));' )
@@ -650,9 +650,9 @@ fn (mut g Gen) gen_str_for_array_fixed(info ast.ArrayFixed, styp string, str_fn_
650650 sym_has_str_method , str_method_expects_ptr , _ := sym.str_method_info ()
651651 elem_str_fn_name := g.get_str_fn (typ)
652652
653- g.type_definitions .writeln ('static string ${str_fn_name} ($styp a); // auto' )
653+ g.definitions .writeln ('static string ${str_fn_name} ($styp a); // auto' )
654654 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp a) { return indent_${str_fn_name} (a, 0);}' )
655- g.type_definitions .writeln ('static string indent_${str_fn_name} ($styp a, int indent_count); // auto' )
655+ g.definitions .writeln ('static string indent_${str_fn_name} ($styp a, int indent_count); // auto' )
656656 g.auto_str_funcs.writeln ('static string indent_${str_fn_name} ($styp a, int indent_count) {' )
657657 g.auto_str_funcs.writeln ('\t strings__Builder sb = strings__new_builder($info.size * 10);' )
658658 g.auto_str_funcs.writeln ('\t strings__Builder_write_string(&sb, _SLIT("["));' )
@@ -727,9 +727,9 @@ fn (mut g Gen) gen_str_for_map(info ast.Map, styp string, str_fn_name string) {
727727 g.get_str_fn (val_typ)
728728 }
729729
730- g.type_definitions .writeln ('static string ${str_fn_name} ($styp m); // auto' )
730+ g.definitions .writeln ('static string ${str_fn_name} ($styp m); // auto' )
731731 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp m) { return indent_${str_fn_name} (m, 0);}' )
732- g.type_definitions .writeln ('static string indent_${str_fn_name} ($styp m, int indent_count); // auto' )
732+ g.definitions .writeln ('static string indent_${str_fn_name} ($styp m, int indent_count); // auto' )
733733 g.auto_str_funcs.writeln ('static string indent_${str_fn_name} ($styp m, int indent_count) { /* gen_str_for_map */' )
734734 g.auto_str_funcs.writeln ('\t strings__Builder sb = strings__new_builder(m.key_values.len*10);' )
735735 g.auto_str_funcs.writeln ('\t strings__Builder_write_string(&sb, _SLIT("{"));' )
@@ -827,9 +827,9 @@ fn (mut g Gen) gen_str_for_struct(info ast.Struct, styp string, str_fn_name stri
827827 eprintln ('> gen_str_for_struct: $info.parent_type.debug () | $styp | $str_fn_name ' )
828828 }
829829 // _str() functions should have a single argument, the indenting ones take 2:
830- g.type_definitions .writeln ('static string ${str_fn_name} ($styp it); // auto' )
830+ g.definitions .writeln ('static string ${str_fn_name} ($styp it); // auto' )
831831 g.auto_str_funcs.writeln ('static string ${str_fn_name} ($styp it) { return indent_${str_fn_name} (it, 0);}' )
832- g.type_definitions .writeln ('static string indent_${str_fn_name} ($styp it, int indent_count); // auto' )
832+ g.definitions .writeln ('static string indent_${str_fn_name} ($styp it, int indent_count); // auto' )
833833 mut fn_builder := strings.new_builder (512 )
834834 defer {
835835 g.auto_fn_definitions << fn_builder.str ()
0 commit comments