@@ -12,16 +12,16 @@ type path = [path_elt];
12
12
fn path_to_str_with_sep ( p : path , sep : str ) -> str {
13
13
let strs = vec:: map ( p) { |e|
14
14
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 }
17
17
}
18
18
} ;
19
19
str:: connect ( strs, sep)
20
20
}
21
21
22
22
fn path_ident_to_str ( p : path , i : ident ) -> str {
23
23
if vec:: is_empty ( p) {
24
- i
24
+ /* FIXME: bad */ copy i
25
25
} else {
26
26
#fmt[ "%s::%s" , path_to_str ( p) , i]
27
27
}
@@ -59,7 +59,7 @@ type ctx = {map: map, mut path: path,
59
59
mut local_id : uint , diag : span_handler } ;
60
60
type vt = visit:: vt < ctx > ;
61
61
62
- fn extend ( cx : ctx , elt : str ) -> @path {
62
+ fn extend ( cx : ctx , + elt : str ) -> @path {
63
63
@( cx . path + [ path_name ( elt ) ] )
64
64
}
65
65
@@ -89,15 +89,15 @@ fn map_crate(diag: span_handler, c: crate) -> map {
89
89
// crate. The `path` should be the path to the item but should not include
90
90
// the item itself.
91
91
fn map_decoded_item ( diag : span_handler ,
92
- map : map , path : path , ii : inlined_item ) {
92
+ map : map , + path : path, ii : inlined_item ) {
93
93
// I believe it is ok for the local IDs of inlined items from other crates
94
94
// to overlap with the local ids from this crate, so just generate the ids
95
95
// starting from 0. (In particular, I think these ids are only used in
96
96
// alias analysis, which we will not be running on the inlined items, and
97
97
// even if we did I think it only needs an ordering between local
98
98
// variables that are simultaneously in scope).
99
99
let cx = { map: map,
100
- mut path: path ,
100
+ mut path: /* FIXME: bad */ copy path,
101
101
mut local_id: 0 u ,
102
102
diag : diag } ;
103
103
let v = mk_ast_map_visitor ( ) ;
@@ -123,21 +123,27 @@ fn map_decoded_item(diag: span_handler,
123
123
fn map_fn ( fk : visit:: fn_kind , decl : fn_decl , body : blk ,
124
124
sp : codemap:: span , id : node_id , cx : ctx , v : vt ) {
125
125
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) ) ;
127
127
cx. local_id += 1 u;
128
128
}
129
129
alt fk {
130
130
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} ,
133
135
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 ) ) ;
136
140
}
137
141
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 ) ) ;
141
147
}
142
148
143
149
_ { }
@@ -146,7 +152,7 @@ fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
146
152
}
147
153
148
154
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) ) ;
150
156
visit:: visit_block ( b, cx, v) ;
151
157
}
152
158
@@ -180,25 +186,29 @@ fn map_method(impl_did: def_id, impl_path: @path,
180
186
}
181
187
182
188
fn map_item ( i : @item, cx : ctx , v : vt ) {
183
- let item_path = @cx. path ;
189
+ let item_path = @/ * FIXME : bad * / copy cx. path ;
184
190
cx. map . insert ( i. id , node_item ( i, item_path) ) ;
185
191
alt i. node {
186
192
item_impl ( _, _, _, _, ms) {
187
193
let impl_did = ast_util:: local_def ( i. id ) ;
188
194
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) ;
190
197
}
191
198
}
192
199
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 ) ,
195
204
item_path) ) ;
196
205
cx. map . insert ( dtor_id, node_item ( i, item_path) ) ;
197
206
}
198
207
item_enum ( vs, _, _) {
199
208
for vs. each { |v|
200
209
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) ) ) ;
202
212
}
203
213
}
204
214
item_native_mod ( nm) {
@@ -207,7 +217,9 @@ fn map_item(i: @item, cx: ctx, v: vt) {
207
217
either:: right ( abi) { abi }
208
218
} ;
209
219
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) ) ;
211
223
}
212
224
}
213
225
item_class ( tps, ifces, items, ctor, dtor, _) {
@@ -217,17 +229,17 @@ fn map_item(i: @item, cx: ctx, v: vt) {
217
229
vec:: iter ( ifces) { |p| cx. map . insert ( p. id ,
218
230
node_item ( i, item_path) ) ; } ;
219
231
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 ) ;
221
233
// only need to handle methods
222
234
vec:: iter ( ms) { |m| map_method ( d_id, p, m, cx) ; }
223
235
}
224
236
_ { }
225
237
}
226
238
alt i. node {
227
239
item_mod ( _) | item_native_mod ( _) {
228
- cx. path += [ path_mod ( i. ident ) ] ;
240
+ cx. path += [ path_mod ( /* FIXME: bad */ copy i. ident ) ] ;
229
241
}
230
- _ { cx. path += [ path_name ( i. ident ) ] ; }
242
+ _ { cx. path += [ path_name ( /* FIXME: bad */ copy i. ident ) ] ; }
231
243
}
232
244
visit:: visit_item ( i, cx, v) ;
233
245
vec:: pop ( cx. path ) ;
@@ -238,7 +250,7 @@ fn map_view_item(vi: @view_item, cx: ctx, _v: vt) {
238
250
view_item_export ( vps) {
239
251
for vps. each { |vp|
240
252
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) }
242
254
view_path_glob( pth, id) | view_path_list( pth, _, id) {
243
255
( id, path_to_ident( pth) )
244
256
}
0 commit comments