From 776255695a7a6a8a87c54c4db16fdbfb5d2bd42f Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Wed, 27 Apr 2011 13:36:39 -0700 Subject: [PATCH] Use cnames when present in ty.ty_to_str. --- src/comp/middle/ty.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 24078767f19..f5cea365d92 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -544,6 +544,13 @@ fn ty_to_str(ctxt cx, &t typ) -> str { ret mstr + ty_to_str(cx, m.ty); } + alt (cname(cx, typ)) { + case (some[str](?cs)) { + ret cs; + } + case (_) { } + } + auto s = ""; alt (struct(cx, typ)) { @@ -594,16 +601,9 @@ fn ty_to_str(ctxt cx, &t typ) -> str { } case (ty_obj(?meths)) { - alt (cname(cx, typ)) { - case (some[str](?cs)) { - s += cs; - } - 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}"; - } - } + 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)) {