@@ -164,7 +164,8 @@ fn ast_ty_to_ty_crate(@crate_ctxt ccx, &@ast.ty ast_ty) -> @ty.t {
164
164
// We then annotate the AST with the resulting types and return the annotated
165
165
// AST, along with a table mapping item IDs to their types.
166
166
167
- fn collect_item_types( @ast. crate crate) -> tup ( @ast. crate , @ty_table ) {
167
+ fn collect_item_types ( session . session sess, @ast. crate crate)
168
+ -> tup ( @ast. crate , @ty_table ) {
168
169
169
170
type ty_item_table = hashmap [ ast. def_id , @ast. item ] ;
170
171
@@ -344,9 +345,11 @@ fn collect_item_types(@ast.crate crate) -> tup(@ast.crate, @ty_table) {
344
345
// Second pass: translate the types of all items.
345
346
let @ty_table item_to_ty = @common. new_def_hash[ @ty. t] ( ) ;
346
347
347
- type env = rec( @ty_item_table id_to_ty_item,
348
+ type env = rec( session. session sess,
349
+ @ty_item_table id_to_ty_item,
348
350
@ty_table item_to_ty) ;
349
- let @env e = @rec( id_to_ty_item=id_to_ty_item,
351
+ let @env e = @rec( sess=sess,
352
+ id_to_ty_item=id_to_ty_item,
350
353
item_to_ty=item_to_ty) ;
351
354
352
355
fn convert( & @env e, @ast. item i) -> @env {
@@ -413,17 +416,18 @@ fn collect_item_types(@ast.crate crate) -> tup(@ast.crate, @ty_table) {
413
416
let vec[ @ast. method] methods = vec( ) ;
414
417
let vec[ ast. obj_field] fields = vec( ) ;
415
418
416
- let uint n = 0 u;
417
- for ( method meth_ty in meth_tys) {
418
- let @ast. method meth = ob. methods. ( n) ;
419
+ for ( @ast. method meth in ob. methods ) {
420
+ let uint ix = ty. method_idx ( e. sess ,
421
+ sp, meth. node . ident ,
422
+ meth_tys) ;
423
+ let method meth_ty = meth_tys. ( ix) ;
419
424
let ast. method_ m_;
420
425
let @ast. method m;
421
426
auto meth_tfn = plain_ty ( ty. ty_fn ( meth_ty. inputs ,
422
427
meth_ty. output ) ) ;
423
428
m_ = rec ( ann=ast. ann_type ( meth_tfn) with meth. node ) ;
424
429
m = @rec ( node=m_ with * meth) ;
425
430
append[ @ast. method ] ( methods, m) ;
426
- n += 1 u;
427
431
}
428
432
auto g = bind getter ( e. id_to_ty_item , e. item_to_ty , _) ;
429
433
for ( ast. obj_field fld in ob. fields) {
@@ -1529,7 +1533,7 @@ fn update_obj_fields(&@crate_ctxt ccx, @ast.item i) -> @crate_ctxt {
1529
1533
}
1530
1534
1531
1535
fn check_crate ( session. session sess, @ast. crate crate) -> @ast. crate {
1532
- auto result = collect_item_types( crate ) ;
1536
+ auto result = collect_item_types ( sess , crate ) ;
1533
1537
1534
1538
let vec[ ast. obj_field ] fields = vec ( ) ;
1535
1539
0 commit comments