Skip to content

Commit 75d9ec1

Browse files
committed
Merge pull request #2545 from mozilla/incoming
Incoming
2 parents 95b9d53 + cdcae39 commit 75d9ec1

File tree

12 files changed

+274
-214
lines changed

12 files changed

+274
-214
lines changed

src/libsyntax/ast_map.rs

+37-25
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ type path = [path_elt];
1212
fn path_to_str_with_sep(p: path, sep: str) -> str {
1313
let strs = vec::map(p) {|e|
1414
alt e {
15-
path_mod(s) { s }
16-
path_name(s) { s }
15+
path_mod(s) { /* FIXME: bad */ copy s }
16+
path_name(s) { /* FIXME: bad */ copy s }
1717
}
1818
};
1919
str::connect(strs, sep)
2020
}
2121

2222
fn path_ident_to_str(p: path, i: ident) -> str {
2323
if vec::is_empty(p) {
24-
i
24+
/* FIXME: bad */ copy i
2525
} else {
2626
#fmt["%s::%s", path_to_str(p), i]
2727
}
@@ -59,7 +59,7 @@ type ctx = {map: map, mut path: path,
5959
mut local_id: uint, diag: span_handler};
6060
type vt = visit::vt<ctx>;
6161

62-
fn extend(cx: ctx, elt: str) -> @path {
62+
fn extend(cx: ctx, +elt: str) -> @path {
6363
@(cx.path + [path_name(elt)])
6464
}
6565

@@ -89,15 +89,15 @@ fn map_crate(diag: span_handler, c: crate) -> map {
8989
// crate. The `path` should be the path to the item but should not include
9090
// the item itself.
9191
fn map_decoded_item(diag: span_handler,
92-
map: map, path: path, ii: inlined_item) {
92+
map: map, +path: path, ii: inlined_item) {
9393
// I believe it is ok for the local IDs of inlined items from other crates
9494
// to overlap with the local ids from this crate, so just generate the ids
9595
// starting from 0. (In particular, I think these ids are only used in
9696
// alias analysis, which we will not be running on the inlined items, and
9797
// even if we did I think it only needs an ordering between local
9898
// variables that are simultaneously in scope).
9999
let cx = {map: map,
100-
mut path: path,
100+
mut path: /* FIXME: bad */ copy path,
101101
mut local_id: 0u,
102102
diag: diag};
103103
let v = mk_ast_map_visitor();
@@ -123,21 +123,27 @@ fn map_decoded_item(diag: span_handler,
123123
fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
124124
sp: codemap::span, id: node_id, cx: ctx, v: vt) {
125125
for decl.inputs.each {|a|
126-
cx.map.insert(a.id, node_arg(a, cx.local_id));
126+
cx.map.insert(a.id, node_arg(/* FIXME: bad */ copy a, cx.local_id));
127127
cx.local_id += 1u;
128128
}
129129
alt fk {
130130
visit::fk_ctor(nm, tps, self_id, parent_id) {
131-
let ct = @{node: {id: id, self_id: self_id,
132-
dec: decl, body: body},
131+
let ct = @{node: {id: id,
132+
self_id: self_id,
133+
dec: /* FIXME: bad */ copy decl,
134+
body: /* FIXME: bad */ copy body},
133135
span: sp};
134-
cx.map.insert(id, node_ctor(nm, tps, class_ctor(ct, parent_id),
135-
@cx.path));
136+
cx.map.insert(id, node_ctor(/* FIXME: bad */ copy nm,
137+
/* FIXME: bad */ copy tps,
138+
class_ctor(ct, parent_id),
139+
@/* FIXME: bad */ copy cx.path));
136140
}
137141
visit::fk_dtor(tps, self_id, parent_id) {
138-
let dt = @{node: {id: id, self_id: self_id, body: body},
139-
span: sp};
140-
cx.map.insert(id, node_dtor(tps, dt, parent_id, @cx.path));
142+
let dt = @{node: {id: id, self_id: self_id,
143+
body: /* FIXME: bad */ copy body}, span: sp};
144+
cx.map.insert(id, node_dtor(/* FIXME: bad */ copy tps, dt,
145+
parent_id,
146+
@/* FIXME: bad */ copy cx.path));
141147
}
142148

143149
_ {}
@@ -146,7 +152,7 @@ fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
146152
}
147153

148154
fn map_block(b: blk, cx: ctx, v: vt) {
149-
cx.map.insert(b.node.id, node_block(b));
155+
cx.map.insert(b.node.id, node_block(/* FIXME: bad */ copy b));
150156
visit::visit_block(b, cx, v);
151157
}
152158

@@ -180,25 +186,29 @@ fn map_method(impl_did: def_id, impl_path: @path,
180186
}
181187

182188
fn map_item(i: @item, cx: ctx, v: vt) {
183-
let item_path = @cx.path;
189+
let item_path = @/* FIXME: bad */ copy cx.path;
184190
cx.map.insert(i.id, node_item(i, item_path));
185191
alt i.node {
186192
item_impl(_, _, _, _, ms) {
187193
let impl_did = ast_util::local_def(i.id);
188194
for ms.each {|m|
189-
map_method(impl_did, extend(cx, i.ident), m, cx);
195+
map_method(impl_did, extend(cx, /* FIXME: bad */ copy i.ident), m,
196+
cx);
190197
}
191198
}
192199
item_res(decl, tps, _, dtor_id, ctor_id, _) {
193-
cx.map.insert(ctor_id, node_ctor(i.ident, tps,
194-
res_ctor(decl, ctor_id, i.span),
200+
cx.map.insert(ctor_id, node_ctor(/* FIXME: bad */ copy i.ident,
201+
/* FIXME: bad */ copy tps,
202+
res_ctor(/* FIXME: bad */ copy decl,
203+
ctor_id, i.span),
195204
item_path));
196205
cx.map.insert(dtor_id, node_item(i, item_path));
197206
}
198207
item_enum(vs, _, _) {
199208
for vs.each {|v|
200209
cx.map.insert(v.node.id, node_variant(
201-
v, i, extend(cx, i.ident)));
210+
/* FIXME: bad */ copy v, i,
211+
extend(cx, /* FIXME: bad */ copy i.ident)));
202212
}
203213
}
204214
item_native_mod(nm) {
@@ -207,7 +217,9 @@ fn map_item(i: @item, cx: ctx, v: vt) {
207217
either::right(abi) { abi }
208218
};
209219
for nm.items.each {|nitem|
210-
cx.map.insert(nitem.id, node_native_item(nitem, abi, @cx.path));
220+
cx.map.insert(nitem.id,
221+
node_native_item(nitem, abi,
222+
@/* FIXME: bad */ copy cx.path));
211223
}
212224
}
213225
item_class(tps, ifces, items, ctor, dtor, _) {
@@ -217,17 +229,17 @@ fn map_item(i: @item, cx: ctx, v: vt) {
217229
vec::iter(ifces) {|p| cx.map.insert(p.id,
218230
node_item(i, item_path)); };
219231
let d_id = ast_util::local_def(i.id);
220-
let p = extend(cx, i.ident);
232+
let p = extend(cx, /* FIXME: bad */ copy i.ident);
221233
// only need to handle methods
222234
vec::iter(ms) {|m| map_method(d_id, p, m, cx); }
223235
}
224236
_ { }
225237
}
226238
alt i.node {
227239
item_mod(_) | item_native_mod(_) {
228-
cx.path += [path_mod(i.ident)];
240+
cx.path += [path_mod(/* FIXME: bad */ copy i.ident)];
229241
}
230-
_ { cx.path += [path_name(i.ident)]; }
242+
_ { cx.path += [path_name(/* FIXME: bad */ copy i.ident)]; }
231243
}
232244
visit::visit_item(i, cx, v);
233245
vec::pop(cx.path);
@@ -238,7 +250,7 @@ fn map_view_item(vi: @view_item, cx: ctx, _v: vt) {
238250
view_item_export(vps) {
239251
for vps.each {|vp|
240252
let (id, name) = alt vp.node {
241-
view_path_simple(nm, _, id) { (id, nm) }
253+
view_path_simple(nm, _, id) { (id, /* FIXME: bad */ copy nm) }
242254
view_path_glob(pth, id) | view_path_list(pth, _, id) {
243255
(id, path_to_ident(pth))
244256
}

src/libsyntax/ast_util.rs

+15-11
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ fn is_exported(i: ident, m: _mod) -> bool {
156156
for variants.each {|v|
157157
if v.node.name == i {
158158
local = true;
159-
parent_enum = some(it.ident);
159+
parent_enum = some(/* FIXME: bad */ copy it.ident);
160160
}
161161
}
162162
}
@@ -247,12 +247,12 @@ fn block_from_expr(e: @expr) -> blk {
247247
ret {node: blk_, span: e.span};
248248
}
249249

250-
fn default_block(stmts1: [@stmt], expr1: option<@expr>, id1: node_id) ->
250+
fn default_block(+stmts1: [@stmt], expr1: option<@expr>, id1: node_id) ->
251251
blk_ {
252252
{view_items: [], stmts: stmts1, expr: expr1, id: id1, rules: default_blk}
253253
}
254254

255-
fn ident_to_path(s: span, i: ident) -> @path {
255+
fn ident_to_path(s: span, +i: ident) -> @path {
256256
@{span: s, global: false, idents: [i],
257257
rp: none, types: []}
258258
}
@@ -265,7 +265,7 @@ pure fn is_unguarded(&&a: arm) -> bool {
265265
}
266266

267267
pure fn unguarded_pat(a: arm) -> option<[@pat]> {
268-
if is_unguarded(a) { some(a.pats) } else { none }
268+
if is_unguarded(a) { some(/* FIXME: bad */ copy a.pats) } else { none }
269269
}
270270

271271
// Provides an extra node_id to hang callee information on, in case the
@@ -275,8 +275,8 @@ fn op_expr_callee_id(e: @expr) -> node_id { e.id - 1 }
275275

276276
pure fn class_item_ident(ci: @class_member) -> ident {
277277
alt ci.node {
278-
instance_var(i,_,_,_,_) { i }
279-
class_method(it) { it.ident }
278+
instance_var(i,_,_,_,_) { /* FIXME: bad */ copy i }
279+
class_method(it) { /* FIXME: bad */ copy it.ident }
280280
}
281281
}
282282

@@ -294,7 +294,11 @@ fn split_class_items(cs: [@class_member]) -> ([ivar], [@method]) {
294294
for cs.each {|c|
295295
alt c.node {
296296
instance_var(i, t, cm, id, vis) {
297-
vs += [{ident: i, ty: t, cm: cm, id: id, vis: vis}];
297+
vs += [{ident: /* FIXME: bad */ copy i,
298+
ty: t,
299+
cm: cm,
300+
id: id,
301+
vis: vis}];
298302
}
299303
class_method(m) { ms += [m]; }
300304
}
@@ -312,10 +316,10 @@ pure fn class_member_visibility(ci: @class_member) -> visibility {
312316
impl inlined_item_methods for inlined_item {
313317
fn ident() -> ident {
314318
alt self {
315-
ii_item(i) { i.ident }
316-
ii_native(i) { i.ident }
317-
ii_method(_, m) { m.ident }
318-
ii_ctor(_, nm, _, _) { nm }
319+
ii_item(i) { /* FIXME: bad */ copy i.ident }
320+
ii_native(i) { /* FIXME: bad */ copy i.ident }
321+
ii_method(_, m) { /* FIXME: bad */ copy m.ident }
322+
ii_ctor(_, nm, _, _) { /* FIXME: bad */ copy nm }
319323
}
320324
}
321325

0 commit comments

Comments
 (0)