@@ -194,12 +194,12 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr {
194
194
let afp = default_ast_fold ( ) ;
195
195
let f_pre =
196
196
{ fold_ident: bind transcribe_ident ( cx, b, idx_path, _, _) ,
197
- fold_path: bind transcribe_path ( cx, b, idx_path, _, _) ,
197
+ fold_path: bind transcribe_path ( cx, b, idx_path, _, _, _ ) ,
198
198
fold_expr:
199
- bind transcribe_expr ( cx, b, idx_path, _, _, afp. fold_expr ) ,
200
- fold_ty: bind transcribe_type ( cx, b, idx_path, _, _, afp. fold_ty ) ,
199
+ bind transcribe_expr ( cx, b, idx_path, _, _, _ , afp. fold_expr ) ,
200
+ fold_ty: bind transcribe_type ( cx, b, idx_path, _, _, _ , afp. fold_ty ) ,
201
201
fold_block:
202
- bind transcribe_block ( cx, b, idx_path, _, _, afp. fold_block ) ,
202
+ bind transcribe_block ( cx, b, idx_path, _, _, _ , afp. fold_block ) ,
203
203
map_exprs: bind transcribe_exprs ( cx, b, idx_path, _, _) ,
204
204
new_id: bind new_id ( _, cx) ,
205
205
new_span: bind new_span ( cx, _) with * afp} ;
@@ -209,7 +209,6 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr {
209
209
}
210
210
211
211
212
-
213
212
/* helper: descend into a matcher */
214
213
fn follow ( m : arb_depth < matchable > , idx_path : @mutable [ uint ] ) ->
215
214
arb_depth < matchable > {
@@ -334,64 +333,67 @@ fn transcribe_ident(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
334
333
335
334
336
335
fn transcribe_path ( cx : ext_ctxt , b : bindings , idx_path : @mutable [ uint ] ,
337
- p : path_ , _fld : ast_fold ) -> path_ {
336
+ p : path_ , s : span , _fld : ast_fold ) -> ( path_ , span ) {
338
337
// Don't substitute into qualified names.
339
- if vec:: len ( p. types ) > 0 u || vec:: len ( p. idents ) != 1 u { ret p ; }
338
+ if vec:: len ( p. types ) > 0 u || vec:: len ( p. idents ) != 1 u { ret ( p , s ) ; }
340
339
ret alt follow_for_trans ( cx, b. find ( p. idents [ 0 ] ) , idx_path) {
341
340
some ( match_ident ( id) ) {
342
- { global: false, idents: [ id. node ] , types: [ ] }
341
+ ( { global: false, idents: [ id. node ] , types: [ ] } , s )
343
342
}
344
- some ( match_path ( a_pth) ) { a_pth. node }
343
+ some ( match_path ( a_pth) ) { ( a_pth. node , s ) }
345
344
some ( m) { match_error ( cx, m, "a path" ) }
346
- none { p }
345
+ none { ( p , s ) }
347
346
}
348
347
}
349
348
350
349
351
350
fn transcribe_expr ( cx : ext_ctxt , b : bindings , idx_path : @mutable [ uint ] ,
352
- e : ast:: expr_ , fld : ast_fold ,
353
- orig : fn @( ast:: expr_ , ast_fold ) -> ast:: expr_ ) ->
354
- ast:: expr_ {
351
+ e : ast:: expr_ , s : span , fld : ast_fold ,
352
+ orig : fn @( ast:: expr_ , span , ast_fold ) ->( ast:: expr_ , span ) )
353
+ -> ( ast:: expr_ , span )
354
+ {
355
355
ret alt e {
356
356
expr_path( p) {
357
357
// Don't substitute into qualified names.
358
358
if vec:: len ( p. node . types ) > 0 u || vec:: len ( p. node . idents ) != 1 u {
359
- e ;
359
+ ( e , s ) ;
360
360
}
361
361
alt follow_for_trans ( cx, b. find ( p. node . idents [ 0 ] ) , idx_path) {
362
362
some ( match_ident ( id) ) {
363
- expr_path ( @respan ( id. span ,
364
- { global: false,
365
- idents: [ id. node ] ,
366
- types: [ ] } ) )
363
+ ( expr_path ( @respan ( id. span ,
364
+ { global: false,
365
+ idents: [ id. node ] ,
366
+ types: [ ] } ) ) , s )
367
367
}
368
- some ( match_path ( a_pth) ) { expr_path ( a_pth) }
369
- some ( match_expr ( a_exp) ) { a_exp. node }
368
+ some ( match_path ( a_pth) ) { ( expr_path ( a_pth) , s ) }
369
+ some ( match_expr ( a_exp) ) { ( a_exp. node , s ) }
370
370
some ( m) { match_error ( cx, m, "an expression" ) }
371
- none { orig( e, fld) }
371
+ none { orig( e, s , fld) }
372
372
}
373
373
}
374
- _ { orig( e, fld) }
374
+ _ { orig( e, s , fld) }
375
375
}
376
376
}
377
377
378
378
fn transcribe_type ( cx : ext_ctxt , b : bindings , idx_path : @mutable [ uint ] ,
379
- t : ast:: ty_ , fld : ast_fold ,
380
- orig : fn @( ast:: ty_ , ast_fold ) -> ast:: ty_ ) -> ast:: ty_ {
379
+ t : ast:: ty_ , s : span , fld : ast_fold ,
380
+ orig : fn @( ast:: ty_ , span , ast_fold ) -> ( ast:: ty_ , span ) )
381
+ -> ( ast:: ty_ , span )
382
+ {
381
383
ret alt t {
382
384
ast : : ty_path ( pth, _) {
383
385
alt path_to_ident ( pth) {
384
386
some ( id) {
385
387
alt follow_for_trans ( cx, b. find ( id) , idx_path) {
386
- some ( match_ty ( ty) ) { ty. node }
388
+ some ( match_ty ( ty) ) { ( ty. node , s ) }
387
389
some ( m) { match_error ( cx, m, "a type" ) }
388
- none { orig( t, fld) }
390
+ none { orig( t, s , fld) }
389
391
}
390
392
}
391
- none { orig( t, fld) }
393
+ none { orig( t, s , fld) }
392
394
}
393
395
}
394
- _ { orig( t, fld) }
396
+ _ { orig( t, s , fld) }
395
397
}
396
398
}
397
399
@@ -400,12 +402,14 @@ fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
400
402
`{v}` */
401
403
402
404
fn transcribe_block ( cx : ext_ctxt , b : bindings , idx_path : @mutable [ uint ] ,
403
- blk : blk_ , fld : ast_fold ,
404
- orig : fn @( blk_ , ast_fold ) -> blk_ ) -> blk_ {
405
+ blk : blk_ , s : span , fld : ast_fold ,
406
+ orig : fn @( blk_ , span , ast_fold ) -> ( blk_ , span ) )
407
+ -> ( blk_ , span )
408
+ {
405
409
ret alt block_to_ident ( blk) {
406
410
some ( id) {
407
411
alt follow_for_trans ( cx, b. find ( id) , idx_path) {
408
- some ( match_block ( new_blk) ) { new_blk. node }
412
+ some ( match_block ( new_blk) ) { ( new_blk. node , s ) }
409
413
410
414
411
415
@@ -415,10 +419,10 @@ fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
415
419
some ( m) {
416
420
match_error ( cx, m, "a block" )
417
421
}
418
- none { orig( blk, fld) }
422
+ none { orig( blk, s , fld) }
419
423
}
420
424
}
421
- none { orig( blk, fld) }
425
+ none { orig( blk, s , fld) }
422
426
}
423
427
}
424
428
0 commit comments