summary refs log tree commit diff
path: root/src/libsyntax/ast_map.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-06-07 21:53:47 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-06-07 21:53:47 -0700
commit26faa37305f59e2b09a92b089b78abc4f01da8e8 (patch)
tree68f2618785f4b7fbe324f4ae9839e3c57b2fedd1 /src/libsyntax/ast_map.rs
parent847c5e4e9892ef56873ac52a552997267c4d385a (diff)
downloadrust-26faa37305f59e2b09a92b089b78abc4f01da8e8.tar.gz
rust-26faa37305f59e2b09a92b089b78abc4f01da8e8.zip
syntax: Add a lot of copy keywords
Diffstat (limited to 'src/libsyntax/ast_map.rs')
-rw-r--r--src/libsyntax/ast_map.rs44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index b0cb1d22cf7..b2e6446d7ee 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -123,7 +123,7 @@ fn map_decoded_item(diag: span_handler,
 fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
           sp: codemap::span, id: node_id, cx: ctx, v: vt) {
     for decl.inputs.each {|a|
-        cx.map.insert(a.id, node_arg(a, cx.local_id));
+        cx.map.insert(a.id, node_arg(/* FIXME: bad */ copy a, cx.local_id));
         cx.local_id += 1u;
     }
     alt fk {
@@ -133,13 +133,17 @@ fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
                             dec: /* FIXME: bad */ copy decl,
                             body: /* FIXME: bad */ copy body},
                     span: sp};
-          cx.map.insert(id, node_ctor(/* FIXME: bad */ copy nm, tps,
-                                      class_ctor(ct, parent_id), @cx.path));
+          cx.map.insert(id, node_ctor(/* FIXME: bad */ copy nm,
+                                      /* FIXME: bad */ copy tps,
+                                      class_ctor(ct, parent_id),
+                                      @/* FIXME: bad */ copy cx.path));
        }
       visit::fk_dtor(tps, self_id, parent_id) {
-          let dt = @{node: {id: id, self_id: self_id, body: body},
-                    span: sp};
-          cx.map.insert(id, node_dtor(tps, dt, parent_id, @cx.path));
+          let dt = @{node: {id: id, self_id: self_id,
+                     body: /* FIXME: bad */ copy body}, span: sp};
+          cx.map.insert(id, node_dtor(/* FIXME: bad */ copy tps, dt,
+                                      parent_id,
+                                      @/* FIXME: bad */ copy cx.path));
        }
 
        _ {}
@@ -148,7 +152,7 @@ fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
 }
 
 fn map_block(b: blk, cx: ctx, v: vt) {
-    cx.map.insert(b.node.id, node_block(b));
+    cx.map.insert(b.node.id, node_block(/* FIXME: bad */ copy b));
     visit::visit_block(b, cx, v);
 }
 
@@ -182,25 +186,29 @@ fn map_method(impl_did: def_id, impl_path: @path,
 }
 
 fn map_item(i: @item, cx: ctx, v: vt) {
-    let item_path = @cx.path;
+    let item_path = @/* FIXME: bad */ copy cx.path;
     cx.map.insert(i.id, node_item(i, item_path));
     alt i.node {
       item_impl(_, _, _, _, ms) {
         let impl_did = ast_util::local_def(i.id);
         for ms.each {|m|
-            map_method(impl_did, extend(cx, i.ident), m, cx);
+            map_method(impl_did, extend(cx, /* FIXME: bad */ copy i.ident), m,
+                       cx);
         }
       }
       item_res(decl, tps, _, dtor_id, ctor_id, _) {
-        cx.map.insert(ctor_id, node_ctor(i.ident, tps,
-                                         res_ctor(decl, ctor_id, i.span),
+        cx.map.insert(ctor_id, node_ctor(/* FIXME: bad */ copy i.ident,
+                                         /* FIXME: bad */ copy tps,
+                                         res_ctor(/* FIXME: bad */ copy decl,
+                                                  ctor_id, i.span),
                                          item_path));
         cx.map.insert(dtor_id, node_item(i, item_path));
       }
       item_enum(vs, _, _) {
         for vs.each {|v|
             cx.map.insert(v.node.id, node_variant(
-                v, i, extend(cx, i.ident)));
+                /* FIXME: bad */ copy v, i,
+                extend(cx, /* FIXME: bad */ copy i.ident)));
         }
       }
       item_native_mod(nm) {
@@ -209,7 +217,9 @@ fn map_item(i: @item, cx: ctx, v: vt) {
           either::right(abi) { abi }
         };
         for nm.items.each {|nitem|
-            cx.map.insert(nitem.id, node_native_item(nitem, abi, @cx.path));
+            cx.map.insert(nitem.id,
+                          node_native_item(nitem, abi,
+                                           @/* FIXME: bad */ copy cx.path));
         }
       }
       item_class(tps, ifces, items, ctor, dtor, _) {
@@ -219,7 +229,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
           vec::iter(ifces) {|p| cx.map.insert(p.id,
                                   node_item(i, item_path)); };
           let d_id = ast_util::local_def(i.id);
-          let p = extend(cx, i.ident);
+          let p = extend(cx, /* FIXME: bad */ copy i.ident);
            // only need to handle methods
           vec::iter(ms) {|m| map_method(d_id, p, m, cx); }
       }
@@ -227,9 +237,9 @@ fn map_item(i: @item, cx: ctx, v: vt) {
     }
     alt i.node {
       item_mod(_) | item_native_mod(_) {
-        cx.path += [path_mod(i.ident)];
+        cx.path += [path_mod(/* FIXME: bad */ copy i.ident)];
       }
-      _ { cx.path += [path_name(i.ident)]; }
+      _ { cx.path += [path_name(/* FIXME: bad */ copy i.ident)]; }
     }
     visit::visit_item(i, cx, v);
     vec::pop(cx.path);
@@ -240,7 +250,7 @@ fn map_view_item(vi: @view_item, cx: ctx, _v: vt) {
       view_item_export(vps) {
         for vps.each {|vp|
             let (id, name) = alt vp.node {
-              view_path_simple(nm, _, id) { (id, nm) }
+              view_path_simple(nm, _, id) { (id, /* FIXME: bad */ copy nm) }
               view_path_glob(pth, id) | view_path_list(pth, _, id) {
                 (id, path_to_ident(pth))
               }