@@ -424,19 +424,20 @@ impl server::Group for Rustc {
424
424
group. delimiter . map ( |it| it. id ) . unwrap_or_else ( tt:: TokenId :: unspecified)
425
425
}
426
426
427
- fn set_span ( & mut self , _group : & mut Self :: Group , _span : Self :: Span ) {
428
- // FIXME handle span
427
+ fn set_span ( & mut self , group : & mut Self :: Group , span : Self :: Span ) {
428
+ if let Some ( delim) = & mut group. delimiter {
429
+ delim. id = span;
430
+ }
429
431
}
430
432
431
- fn span_open ( & mut self , _group : & Self :: Group ) -> Self :: Span {
432
- // FIXME handle span
433
- // MySpan(self.span_interner.intern(&MySpanData(group.span_open())))
434
- tt:: TokenId :: unspecified ( )
433
+ fn span_open ( & mut self , group : & Self :: Group ) -> Self :: Span {
434
+ // FIXME we only store one `TokenId` for the delimiters
435
+ group. delimiter . map ( |it| it. id ) . unwrap_or_else ( tt:: TokenId :: unspecified)
435
436
}
436
437
437
- fn span_close ( & mut self , _group : & Self :: Group ) -> Self :: Span {
438
- // FIXME handle span
439
- tt:: TokenId :: unspecified ( )
438
+ fn span_close ( & mut self , group : & Self :: Group ) -> Self :: Span {
439
+ // FIXME we only store one `TokenId` for the delimiters
440
+ group . delimiter . map ( |it| it . id ) . unwrap_or_else ( tt:: TokenId :: unspecified)
440
441
}
441
442
}
442
443
@@ -454,13 +455,11 @@ impl server::Punct for Rustc {
454
455
fn spacing ( & mut self , punct : Self :: Punct ) -> bridge:: Spacing {
455
456
spacing_to_external ( punct. spacing )
456
457
}
457
- fn span ( & mut self , _punct : Self :: Punct ) -> Self :: Span {
458
- // FIXME handle span
459
- tt:: TokenId :: unspecified ( )
458
+ fn span ( & mut self , punct : Self :: Punct ) -> Self :: Span {
459
+ punct. id
460
460
}
461
- fn with_span ( & mut self , punct : Self :: Punct , _span : Self :: Span ) -> Self :: Punct {
462
- // FIXME handle span
463
- punct
461
+ fn with_span ( & mut self , punct : Self :: Punct , span : Self :: Span ) -> Self :: Punct {
462
+ tt:: Punct { id : span, ..punct }
464
463
}
465
464
}
466
465
@@ -474,13 +473,13 @@ impl server::Ident for Rustc {
474
473
)
475
474
}
476
475
477
- fn span ( & mut self , _ident : Self :: Ident ) -> Self :: Span {
478
- // FIXME handle span
479
- tt:: TokenId :: unspecified ( )
476
+ fn span ( & mut self , ident : Self :: Ident ) -> Self :: Span {
477
+ self . ident_interner . get ( ident. 0 ) . 0 . id
480
478
}
481
- fn with_span ( & mut self , ident : Self :: Ident , _span : Self :: Span ) -> Self :: Ident {
482
- // FIXME handle span
483
- ident
479
+ fn with_span ( & mut self , ident : Self :: Ident , span : Self :: Span ) -> Self :: Ident {
480
+ let data = self . ident_interner . get ( ident. 0 ) ;
481
+ let new = IdentData ( tt:: Ident { id : span, ..data. 0 . clone ( ) } ) ;
482
+ IdentId ( self . ident_interner . intern ( & new) )
484
483
}
485
484
}
486
485
@@ -500,8 +499,8 @@ impl server::Literal for Rustc {
500
499
None
501
500
}
502
501
503
- fn to_string ( & mut self , _literal : & Self :: Literal ) -> String {
504
- _literal . to_string ( )
502
+ fn to_string ( & mut self , literal : & Self :: Literal ) -> String {
503
+ literal . to_string ( )
505
504
}
506
505
507
506
fn integer ( & mut self , n : & str ) -> Self :: Literal {
@@ -581,8 +580,8 @@ impl server::Literal for Rustc {
581
580
literal. id
582
581
}
583
582
584
- fn set_span ( & mut self , _literal : & mut Self :: Literal , _span : Self :: Span ) {
585
- // FIXME handle span
583
+ fn set_span ( & mut self , literal : & mut Self :: Literal , span : Self :: Span ) {
584
+ literal . id = span;
586
585
}
587
586
588
587
fn subspan (
0 commit comments