Use cnames when present in ty.ty_to_str.

This commit is contained in:
Graydon Hoare 2011-04-27 13:36:39 -07:00
parent 12925505fb
commit 776255695a

View File

@ -544,6 +544,13 @@ fn ty_to_str(ctxt cx, &t typ) -> str {
ret mstr + ty_to_str(cx, m.ty); ret mstr + ty_to_str(cx, m.ty);
} }
alt (cname(cx, typ)) {
case (some[str](?cs)) {
ret cs;
}
case (_) { }
}
auto s = ""; auto s = "";
alt (struct(cx, typ)) { alt (struct(cx, typ)) {
@ -594,16 +601,9 @@ fn ty_to_str(ctxt cx, &t typ) -> str {
} }
case (ty_obj(?meths)) { case (ty_obj(?meths)) {
alt (cname(cx, typ)) { auto f = bind method_to_str(cx, _);
case (some[str](?cs)) { auto m = _vec.map[method,str](f, meths);
s += cs; s += "obj {\n\t" + _str.connect(m, "\n\t") + "\n}";
}
case (_) {
auto f = bind method_to_str(cx, _);
auto m = _vec.map[method,str](f, meths);
s += "obj {\n\t" + _str.connect(m, "\n\t") + "\n}";
}
}
} }
case (ty_var(?v)) { case (ty_var(?v)) {