@@ -2287,21 +2287,13 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
2287
2287
alt ( anon_obj. with_obj) {
2288
2288
case ( none) { }
2289
2289
case ( some( ?e) ) {
2290
- // This had better have object type. TOOD : report an
2290
+ // This had better have object type. TODO : report an
2291
2291
// error if the user is trying to extend a non-object
2292
2292
// with_obj.
2293
2293
check_expr( fcx, e) ;
2294
2294
}
2295
2295
}
2296
2296
2297
- // Typecheck the methods.
2298
- for ( @ast:: method method in anon_obj. methods) {
2299
- check_method( fcx. ccx, method) ;
2300
- }
2301
-
2302
- auto t = next_ty_var( fcx) ;
2303
-
2304
-
2305
2297
// FIXME: These next three functions are largely ripped off from
2306
2298
// similar ones in collect::. Is there a better way to do this?
2307
2299
@@ -2328,11 +2320,28 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
2328
2320
anon_obj. methods) ;
2329
2321
}
2330
2322
2331
- auto methods = get_anon_obj_method_types( fcx. ccx, anon_obj) ;
2323
+ auto method_types = get_anon_obj_method_types( fcx. ccx, anon_obj) ;
2332
2324
auto ot = ty:: mk_obj( fcx. ccx. tcx,
2333
- ty:: sort_methods( methods ) ) ;
2325
+ ty:: sort_methods( method_types ) ) ;
2334
2326
write:: ty_only_fixup( fcx, a. id, ot) ;
2335
2327
2328
+ // Write the methods into the node type table. (This happens in
2329
+ // collect::convert for regular objects.)
2330
+ auto i = 0 u;
2331
+ while ( i < vec:: len[ @ast:: method] ( anon_obj. methods) ) {
2332
+ write:: ty_only( fcx. ccx. tcx, anon_obj. methods. ( i) . node. ann. id,
2333
+ ty:: method_ty_to_fn_ty( fcx. ccx. tcx,
2334
+ method_types. ( i) ) ) ;
2335
+ i += 1 u;
2336
+ }
2337
+
2338
+ // Typecheck the methods.
2339
+ for ( @ast:: method method in anon_obj. methods) {
2340
+ check_method( fcx. ccx, method) ;
2341
+ }
2342
+
2343
+ auto t = next_ty_var( fcx) ;
2344
+
2336
2345
// Now remove the info from the stack.
2337
2346
vec:: pop[ obj_info] ( fcx. ccx. obj_infos) ;
2338
2347
}
0 commit comments