parent
938e9b61b5
commit
a3ed9c1bbd
|
@ -563,11 +563,12 @@ fn (mut g Gen) gen_str_for_array_fixed(info ast.ArrayFixed, styp string, str_fn_
|
|||
g.auto_str_funcs.writeln('static string indent_${str_fn_name}($styp a, int indent_count) {')
|
||||
g.auto_str_funcs.writeln('\tstrings__Builder sb = strings__new_builder($info.size * 10);')
|
||||
g.auto_str_funcs.writeln('\tstrings__Builder_write_string(&sb, _SLIT("["));')
|
||||
g.auto_str_funcs.writeln('\tfor (int i = 0; i < $info.size; ++i) {')
|
||||
if sym.kind == .function {
|
||||
g.auto_str_funcs.writeln('\t\tstring x = ${elem_str_fn_name}();')
|
||||
g.auto_str_funcs.writeln('\t\tstrings__Builder_write_string(&sb, x);')
|
||||
} else {
|
||||
deref, deref_label := deref_kind(str_method_expects_ptr, is_elem_ptr, typ)
|
||||
g.auto_str_funcs.writeln('\tfor (int i = 0; i < $info.size; ++i) {')
|
||||
if should_use_indent_func(sym.kind) && !sym_has_str_method {
|
||||
if is_elem_ptr {
|
||||
g.auto_str_funcs.writeln('\t\tstrings__Builder_write_string(&sb, _SLIT("$deref_label"));')
|
||||
|
|
|
@ -438,3 +438,9 @@ fn test_multi_return() {
|
|||
value: 'two'
|
||||
})"
|
||||
}
|
||||
|
||||
fn test_fixed_array_of_function() {
|
||||
a := [println, println]!
|
||||
println(a)
|
||||
assert '$a' == '[fn (string), fn (string)]'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue