@@ -90,64 +90,61 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> str {
90
90
ret mstr + ty_to_str ( cx, m. ty ) ;
91
91
}
92
92
alt cname( cx, typ) { some ( cs) { ret cs; } _ { } }
93
- let s = "" ;
94
- alt struct( cx, typ) {
95
- ty_native ( _) { s += "native" ; }
96
- ty_nil. { s += "()" ; }
97
- ty_bot. { s += "_|_" ; }
98
- ty_bool. { s += "bool" ; }
99
- ty_int. { s += "int" ; }
100
- ty_float. { s += "float" ; }
101
- ty_uint. { s += "uint" ; }
102
- ty_machine ( tm) { s += ty_mach_to_str ( tm) ; }
103
- ty_char. { s += "char" ; }
104
- ty_str. { s += "str" ; }
105
- ty_istr. { s += "istr" ; }
106
- ty_box ( tm) { s += "@" + mt_to_str ( cx, tm) ; }
107
- ty_uniq ( t) { s += "~" + ty_to_str ( cx, t) ; }
108
- ty_vec ( tm) { s += "[" + mt_to_str ( cx, tm) + "]" ; }
109
- ty_type. { s += "type" ; }
93
+ ret alt struct ( cx, typ) {
94
+ ty_native ( _) { "native" }
95
+ ty_nil. { "()" }
96
+ ty_bot. { "_|_" }
97
+ ty_bool. { "bool" }
98
+ ty_int. { "int" }
99
+ ty_float. { "float" }
100
+ ty_uint. { "uint" }
101
+ ty_machine ( tm) { ty_mach_to_str ( tm) }
102
+ ty_char. { "char" }
103
+ ty_str. { "str" }
104
+ ty_istr. { "istr" }
105
+ ty_box ( tm) { "@" + mt_to_str ( cx, tm) }
106
+ ty_uniq ( t) { "~" + ty_to_str ( cx, t) }
107
+ ty_vec ( tm) { "[" + mt_to_str ( cx, tm) + "]" }
108
+ ty_type. { "type" }
110
109
ty_rec ( elems) {
111
110
let strs: [ str ] = ~[ ] ;
112
111
for fld: field in elems { strs += ~[ field_to_str ( cx, fld) ] ; }
113
- s += "{" + str:: connect ( strs, "," ) + "}" ;
112
+ "{" + str:: connect ( strs, "," ) + "}"
114
113
}
115
114
ty_tup ( elems) {
116
115
let strs = ~[ ] ;
117
116
for elem in elems { strs += ~[ ty_to_str ( cx, elem) ] ; }
118
- s += "(" + str:: connect ( strs, "," ) + ")" ;
117
+ "(" + str:: connect ( strs, "," ) + ")"
119
118
}
120
119
ty_tag ( id, tps) {
121
- s + = get_id_ident ( cx, id) ;
120
+ let s = get_id_ident ( cx, id) ;
122
121
if vec:: len :: < t > ( tps) > 0 u {
123
122
let strs: [ str ] = ~[ ] ;
124
123
for typ: t in tps { strs += ~[ ty_to_str ( cx, typ) ] ; }
125
124
s += "[" + str:: connect ( strs, "," ) + "]" ;
126
125
}
126
+ s
127
127
}
128
128
ty_fn ( proto, inputs, output, cf, constrs) {
129
- s += fn_to_str ( cx, proto, none, inputs, output, cf, constrs) ;
129
+ fn_to_str ( cx, proto, none, inputs, output, cf, constrs)
130
130
}
131
131
ty_native_fn ( _, inputs, output) {
132
- s +=
133
- fn_to_str ( cx, ast:: proto_fn, none, inputs, output, ast:: return,
134
- ~[ ] ) ;
132
+ fn_to_str ( cx, ast:: proto_fn, none, inputs, output, ast:: return, ~[ ] )
135
133
}
136
134
ty_obj ( meths) {
137
135
let strs = ~[ ] ;
138
136
for m: method in meths { strs += ~[ method_to_str ( cx, m) ] ; }
139
- s += "obj {\n \t " + str:: connect ( strs, "\n \t " ) + "\n }" ;
137
+ "obj {\n \t " + str:: connect ( strs, "\n \t " ) + "\n }"
140
138
}
141
139
ty_res ( id, _, _) {
142
- s += get_id_ident ( cx, id) ;
140
+ get_id_ident ( cx, id)
143
141
}
144
- ty_var ( v) { s += "<T" + int:: str ( v) + ">" ; }
142
+ ty_var ( v) { "<T" + int:: str ( v) + ">" }
145
143
ty_param ( id, _) {
146
- s += "'" + str:: unsafe_from_bytes ( ~[ ( 'a' as u8 ) + ( id as u8 ) ] ) ;
144
+ "'" + str:: unsafe_from_bytes ( ~[ ( 'a' as u8 ) + ( id as u8 ) ] )
147
145
}
148
- _ { s += ty_to_short_str ( cx, typ) ; }
146
+ _ { ty_to_short_str( cx, typ) }
149
147
}
150
- ret s;
151
148
}
152
149
153
150
fn ty_to_short_str ( cx : & ctxt , typ : t ) -> str {
0 commit comments