diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index abde1ebc9a8f..6bcc1ad7288b 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -6252,12 +6252,8 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj, // create_vtbl() wants an ast::_obj and all we have is an ast::anon_obj, // so we need to roll our own. - fn anon_obj_field_to_obj_field(&ast::anon_obj_field f) - -> ast::obj_field { - ret rec(mut=f.mut, ty=f.ty, ident=f.ident, id=f.id); - } let ast::_obj wrapper_obj = rec( - fields = std::ivec::map(anon_obj_field_to_obj_field, + fields = std::ivec::map(ast::obj_field_from_anon_obj_field, additional_fields), methods = anon_obj.methods, dtor = none[@ast::method]); diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index e76bef2cf0ce..677262311de4 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -2481,12 +2481,9 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) { } } - fn ao_field_to_o_field(&ast::anon_obj_field f) - -> ast::obj_field { - ret rec(mut=f.mut, ty=f.ty, ident=f.ident, id=f.id); - } fcx.ccx.obj_infos += - ~[anon_obj(ivec::map(ao_field_to_o_field, fields), + ~[anon_obj(ivec::map(ast::obj_field_from_anon_obj_field, + fields), with_obj_sty)]; methods += with_obj_methods; diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index e710a8b2b849..04c24aad99a5 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -664,6 +664,11 @@ fn block_from_expr(@expr e) -> block { ret rec(node=blk_, span=e.span); } + +fn obj_field_from_anon_obj_field(&anon_obj_field f) -> obj_field { + ret rec(mut=f.mut, ty=f.ty, ident=f.ident, id=f.id); +} + // This is a convenience function to transfor ternary expressions to if // expressions so that they can be treated the same fn ternary_to_if(&@expr e) -> @ast::expr {