@@ -423,19 +423,20 @@ impl server::Group for Rustc {
423
423
group. delimiter . map ( |it| it. id ) . unwrap_or_else ( tt:: TokenId :: unspecified)
424
424
}
425
425
426
- fn set_span ( & mut self , _group : & mut Self :: Group , _span : Self :: Span ) {
427
- // FIXME handle span
426
+ fn set_span ( & mut self , group : & mut Self :: Group , span : Self :: Span ) {
427
+ if let Some ( delim) = & mut group. delimiter {
428
+ delim. id = span;
429
+ }
428
430
}
429
431
430
- fn span_open ( & mut self , _group : & Self :: Group ) -> Self :: Span {
431
- // FIXME handle span
432
- // MySpan(self.span_interner.intern(&MySpanData(group.span_open())))
433
- tt:: TokenId :: unspecified ( )
432
+ fn span_open ( & mut self , group : & Self :: Group ) -> Self :: Span {
433
+ // FIXME we only store one `TokenId` for the delimiters
434
+ group. delimiter . map ( |it| it. id ) . unwrap_or_else ( tt:: TokenId :: unspecified)
434
435
}
435
436
436
- fn span_close ( & mut self , _group : & Self :: Group ) -> Self :: Span {
437
- // FIXME handle span
438
- tt:: TokenId :: unspecified ( )
437
+ fn span_close ( & mut self , group : & Self :: Group ) -> Self :: Span {
438
+ // FIXME we only store one `TokenId` for the delimiters
439
+ group . delimiter . map ( |it| it . id ) . unwrap_or_else ( tt:: TokenId :: unspecified)
439
440
}
440
441
}
441
442
@@ -453,13 +454,11 @@ impl server::Punct for Rustc {
453
454
fn spacing ( & mut self , punct : Self :: Punct ) -> bridge:: Spacing {
454
455
spacing_to_external ( punct. spacing )
455
456
}
456
- fn span ( & mut self , _punct : Self :: Punct ) -> Self :: Span {
457
- // FIXME handle span
458
- tt:: TokenId :: unspecified ( )
457
+ fn span ( & mut self , punct : Self :: Punct ) -> Self :: Span {
458
+ punct. id
459
459
}
460
- fn with_span ( & mut self , punct : Self :: Punct , _span : Self :: Span ) -> Self :: Punct {
461
- // FIXME handle span
462
- punct
460
+ fn with_span ( & mut self , punct : Self :: Punct , span : Self :: Span ) -> Self :: Punct {
461
+ tt:: Punct { id : span, ..punct }
463
462
}
464
463
}
465
464
@@ -473,13 +472,13 @@ impl server::Ident for Rustc {
473
472
)
474
473
}
475
474
476
- fn span ( & mut self , _ident : Self :: Ident ) -> Self :: Span {
477
- // FIXME handle span
478
- tt:: TokenId :: unspecified ( )
475
+ fn span ( & mut self , ident : Self :: Ident ) -> Self :: Span {
476
+ self . ident_interner . get ( ident. 0 ) . 0 . id
479
477
}
480
- fn with_span ( & mut self , ident : Self :: Ident , _span : Self :: Span ) -> Self :: Ident {
481
- // FIXME handle span
482
- ident
478
+ fn with_span ( & mut self , ident : Self :: Ident , span : Self :: Span ) -> Self :: Ident {
479
+ let data = self . ident_interner . get ( ident. 0 ) ;
480
+ let new = IdentData ( tt:: Ident { id : span, ..data. 0 . clone ( ) } ) ;
481
+ IdentId ( self . ident_interner . intern ( & new) )
483
482
}
484
483
}
485
484
0 commit comments