Skip to content

Commit 9db635c

Browse files
lkupergraydon
authored andcommitted
---
yaml --- r: 1797 b: refs/heads/master c: 0ce0c4c h: refs/heads/master i: 1795: 6d6ab1d v: v3
1 parent ae03352 commit 9db635c

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: bcf04e253f0cc963f0e529a0ceef2268cb7916e1
2+
refs/heads/master: 0ce0c4c41af189bdbd5c797304f2405fc36387e5

trunk/src/comp/middle/ty.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,17 @@ fn ty_to_str(&@t typ) -> str {
115115
option.t[ast.ident] ident,
116116
vec[arg] inputs, @t output) -> str {
117117
auto f = fn_input_to_str;
118-
auto s = "fn";
119-
if (proto == ast.proto_iter) {
120-
s = "iter";
118+
119+
auto s;
120+
alt (proto) {
121+
case (ast.proto_iter) {
122+
s = "iter";
123+
}
124+
case (ast.proto_fn) {
125+
s = "fn";
126+
}
121127
}
128+
122129
alt (ident) {
123130
case (some[ast.ident](?i)) {
124131
s += " ";
@@ -206,9 +213,16 @@ fn ty_to_str(&@t typ) -> str {
206213
}
207214

208215
case (ty_obj(?meths)) {
209-
auto f = method_to_str;
210-
auto m = _vec.map[method,str](f, meths);
211-
s += "obj {\n\t" + _str.connect(m, "\n\t") + "\n}";
216+
alt (typ.cname) {
217+
case (some[str](?cs)) {
218+
s += cs;
219+
}
220+
case (_) {
221+
auto f = method_to_str;
222+
auto m = _vec.map[method,str](f, meths);
223+
s += "obj {\n\t" + _str.connect(m, "\n\t") + "\n}";
224+
}
225+
}
212226
}
213227

214228
case (ty_var(?v)) {

trunk/src/comp/middle/typeck.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,19 +538,22 @@ fn collect_item_types(session.session sess, @ast.crate crate)
538538

539539
fn ty_of_obj(@ty_item_table id_to_ty_item,
540540
@ty_table item_to_ty,
541+
&ast.ident id,
541542
&ast._obj obj_info) -> @ty.t {
542543
auto f = bind ty_of_method(id_to_ty_item, item_to_ty, _);
543544
auto methods =
544545
_vec.map[@ast.method,method](f, obj_info.methods);
545546

546-
auto t_obj = plain_ty(ty.ty_obj(ty.sort_methods(methods)));
547+
auto t_obj = @rec(struct=ty.ty_obj(ty.sort_methods(methods)),
548+
cname=some[str](id));
547549
ret t_obj;
548550
}
549551

550552
fn ty_of_obj_ctor(@ty_item_table id_to_ty_item,
551553
@ty_table item_to_ty,
554+
&ast.ident id,
552555
&ast._obj obj_info) -> @ty.t {
553-
auto t_obj = ty_of_obj(id_to_ty_item, item_to_ty, obj_info);
556+
auto t_obj = ty_of_obj(id_to_ty_item, item_to_ty, id, obj_info);
554557
let vec[arg] t_inputs = vec();
555558
for (ast.obj_field f in obj_info.fields) {
556559
auto g = bind getter(id_to_ty_item, item_to_ty, _);
@@ -584,6 +587,7 @@ fn collect_item_types(session.session sess, @ast.crate crate)
584587
// TODO: handle ty-params
585588
auto t_ctor = ty_of_obj_ctor(id_to_ty_item,
586589
item_to_ty,
590+
ident,
587591
obj_info);
588592
item_to_ty.insert(def_id, t_ctor);
589593
ret t_ctor;

0 commit comments

Comments
 (0)