@@ -187,18 +187,16 @@ public fn void TypeRefHolder.setPrefix(TypeRefHolder* h, SrcLoc loc, u32 name_id
187187}
188188
189189public fn void TypeRefHolder.dump(const TypeRefHolder* h) @(unused) {
190+ string_buffer.Buf* out = ast.getDumpBuf();
190191 const TypeRef* r = (TypeRef*)&h.ref;
191- string_buffer.Buf* out = string_buffer.create(128, useColor(), 2);
192192 r.print(out, false);
193193 for (u32 i=0; i<r.getNumArrays(); i++) {
194194 out.add1('[');
195195 Expr* size = h.arrays[i];
196196 if (size) h.arrays[i].printLiteral(out);
197197 out.add1(']');
198198 }
199- out.color(col_Normal);
200- stdio.puts(out.data());
201- out.free();
199+ ast.flushDumpBuf(out);
202200}
203201
204202
@@ -532,16 +530,14 @@ fn void TypeRef.print(const TypeRef* r, string_buffer.Buf* out, bool filled) {
532530
533531// Note: only use on filled TypeRef
534532public fn void TypeRef.dump(const TypeRef* r) @(unused) {
535- string_buffer.Buf* out = string_buffer.create(128, useColor(), 2 );
533+ string_buffer.Buf* out = ast.getDumpBuf( );
536534 r.print(out, true);
537- out.color(col_Normal);
538- stdio.puts(out.data());
539- out.free();
535+ ast.flushDumpBuf(out);
540536}
541537
542538// Note: only use on filled TypeRef
543539public fn void TypeRef.dump_full(const TypeRef* r) @(unused) {
544- string_buffer.Buf* out = string_buffer.create(1024, useColor(), 2 );
540+ string_buffer.Buf* out = ast.getDumpBuf( );
545541 out.add("TypeRef:\n");
546542 out.indent(1);
547543 out.add("flags:");
@@ -560,10 +556,7 @@ public fn void TypeRef.dump_full(const TypeRef* r) @(unused) {
560556 const Ref* ref = &r.refs[i];
561557 out.print("ref[%d] loc %d name_idx %d decl %p\n", i, ref.loc, ref.name_idx, ref.decl);
562558 }
563-
564- out.color(col_Normal);
565- stdio.puts(out.data());
566- out.free();
559+ ast.flushDumpBuf(out);
567560}
568561
569562public fn const char* TypeRef.diagName(const TypeRef* r) {
0 commit comments