Make sure the pretty-printer understand resources

This commit is contained in:
Marijn Haverbeke 2011-07-01 10:43:23 +02:00
parent 7b1b5d5a8a
commit bf20fe5575
2 changed files with 4 additions and 1 deletions

View File

@ -139,6 +139,9 @@ fn ty_to_str(&ctxt cx, &t typ) -> str {
auto m = vec::map[method, str](f, meths);
s += "obj {\n\t" + str::connect(m, "\n\t") + "\n}";
}
case (ty_res(?id, _, _)) {
s += "<resource#" + istr(id._0) + ":" + istr(id._1) + ">";
}
case (ty_var(?v)) { s += "<T" + istr(v) + ">"; }
case (ty_param(?id)) {
s += "'" + str::unsafe_from_bytes([('a' as u8) + (id as u8)]);

View File

@ -442,7 +442,7 @@ fn print_item(&ps s, &@ast::item item) {
bclose(s, item.span);
}
case (ast::item_res(?dt, ?dt_id, ?tps, ?ct_id)) {
head(s, "res");
head(s, "resource");
word(s.s, item.ident);
print_type_params(s, tps);
popen(s);