about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorLindsey Kuper <lkuper@mozilla.com>2011-07-21 15:10:12 -0700
committerLindsey Kuper <lkuper@mozilla.com>2011-07-21 15:12:27 -0700
commit8ebd29225379d8ab2229f411a16eae880c887b9b (patch)
treee9736fa179af77428ce545de5112995e3cb43bbe /src/comp
parent55acc737a88f3084f68bac55b681a4016292e5b1 (diff)
downloadrust-8ebd29225379d8ab2229f411a16eae880c887b9b.tar.gz
rust-8ebd29225379d8ab2229f411a16eae880c887b9b.zip
Consolidate obj_field_from_anon_obj_field().
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/trans.rs6
-rw-r--r--src/comp/middle/typeck.rs7
-rw-r--r--src/comp/syntax/ast.rs5
3 files changed, 8 insertions, 10 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index abde1ebc9a8..6bcc1ad7288 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 e76bef2cf0c..677262311de 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 e710a8b2b84..04c24aad99a 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 {