cgen: cleanup the generated code for dump(x)
parent
2d43fdb42a
commit
89c08c6292
|
@ -45,17 +45,16 @@ fn (mut g Gen) dump_expr_definitions() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
mut surrounder := util.new_surrounder(3)
|
mut surrounder := util.new_surrounder(3)
|
||||||
surrounder.add('string sline = int_str(line);', 'string_free(&sline);')
|
surrounder.add('\tstring sline = int_str(line);', '\tstring_free(&sline);')
|
||||||
surrounder.add('string value = ${to_string_fn_name}(${deref}dump_arg);', 'string_free(&value);')
|
surrounder.add('\tstring value = ${to_string_fn_name}(${deref}dump_arg);', '\tstring_free(&value);')
|
||||||
surrounder.add('
|
surrounder.add('
|
||||||
string res;
|
strings__Builder sb = strings__new_builder(256);
|
||||||
strings__Builder sb = strings__new_builder(256);
|
', '
|
||||||
',
|
string res;
|
||||||
'
|
res = strings__Builder_str(&sb);
|
||||||
res = strings__Builder_str(&sb);
|
eprint(res);
|
||||||
eprint(res);
|
string_free(&res);
|
||||||
string_free(&res);
|
strings__Builder_free(&sb);
|
||||||
strings__Builder_free(&sb);
|
|
||||||
')
|
')
|
||||||
surrounder.builder_write_befores(mut dump_fns)
|
surrounder.builder_write_befores(mut dump_fns)
|
||||||
dump_fns.writeln("\tstrings__Builder_write_rune(&sb, '[');")
|
dump_fns.writeln("\tstrings__Builder_write_rune(&sb, '[');")
|
||||||
|
|
Loading…
Reference in New Issue