mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-28 04:45:05 +00:00
Merge #10633
10633: fix: Implement most proc_macro span handling for other ABIs r=Veykril a=Veykril Follow up to #10378 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
e4ca952be6
2 changed files with 40 additions and 42 deletions
|
@ -423,19 +423,20 @@ impl server::Group for Rustc {
|
||||||
group.delimiter.map(|it| it.id).unwrap_or_else(tt::TokenId::unspecified)
|
group.delimiter.map(|it| it.id).unwrap_or_else(tt::TokenId::unspecified)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_span(&mut self, _group: &mut Self::Group, _span: Self::Span) {
|
fn set_span(&mut self, group: &mut Self::Group, span: Self::Span) {
|
||||||
// FIXME handle span
|
if let Some(delim) = &mut group.delimiter {
|
||||||
|
delim.id = span;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn span_open(&mut self, _group: &Self::Group) -> Self::Span {
|
fn span_open(&mut self, group: &Self::Group) -> Self::Span {
|
||||||
// FIXME handle span
|
// FIXME we only store one `TokenId` for the delimiters
|
||||||
// MySpan(self.span_interner.intern(&MySpanData(group.span_open())))
|
group.delimiter.map(|it| it.id).unwrap_or_else(tt::TokenId::unspecified)
|
||||||
tt::TokenId::unspecified()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn span_close(&mut self, _group: &Self::Group) -> Self::Span {
|
fn span_close(&mut self, group: &Self::Group) -> Self::Span {
|
||||||
// FIXME handle span
|
// FIXME we only store one `TokenId` for the delimiters
|
||||||
tt::TokenId::unspecified()
|
group.delimiter.map(|it| it.id).unwrap_or_else(tt::TokenId::unspecified)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,13 +454,11 @@ impl server::Punct for Rustc {
|
||||||
fn spacing(&mut self, punct: Self::Punct) -> bridge::Spacing {
|
fn spacing(&mut self, punct: Self::Punct) -> bridge::Spacing {
|
||||||
spacing_to_external(punct.spacing)
|
spacing_to_external(punct.spacing)
|
||||||
}
|
}
|
||||||
fn span(&mut self, _punct: Self::Punct) -> Self::Span {
|
fn span(&mut self, punct: Self::Punct) -> Self::Span {
|
||||||
// FIXME handle span
|
punct.id
|
||||||
tt::TokenId::unspecified()
|
|
||||||
}
|
}
|
||||||
fn with_span(&mut self, punct: Self::Punct, _span: Self::Span) -> Self::Punct {
|
fn with_span(&mut self, punct: Self::Punct, span: Self::Span) -> Self::Punct {
|
||||||
// FIXME handle span
|
tt::Punct { id: span, ..punct }
|
||||||
punct
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,13 +472,13 @@ impl server::Ident for Rustc {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn span(&mut self, _ident: Self::Ident) -> Self::Span {
|
fn span(&mut self, ident: Self::Ident) -> Self::Span {
|
||||||
// FIXME handle span
|
self.ident_interner.get(ident.0).0.id
|
||||||
tt::TokenId::unspecified()
|
|
||||||
}
|
}
|
||||||
fn with_span(&mut self, ident: Self::Ident, _span: Self::Span) -> Self::Ident {
|
fn with_span(&mut self, ident: Self::Ident, span: Self::Span) -> Self::Ident {
|
||||||
// FIXME handle span
|
let data = self.ident_interner.get(ident.0);
|
||||||
ident
|
let new = IdentData(tt::Ident { id: span, ..data.0.clone() });
|
||||||
|
IdentId(self.ident_interner.intern(&new))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -423,19 +423,20 @@ impl server::Group for Rustc {
|
||||||
group.delimiter.map(|it| it.id).unwrap_or_else(tt::TokenId::unspecified)
|
group.delimiter.map(|it| it.id).unwrap_or_else(tt::TokenId::unspecified)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_span(&mut self, _group: &mut Self::Group, _span: Self::Span) {
|
fn set_span(&mut self, group: &mut Self::Group, span: Self::Span) {
|
||||||
// FIXME handle span
|
if let Some(delim) = &mut group.delimiter {
|
||||||
|
delim.id = span;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn span_open(&mut self, _group: &Self::Group) -> Self::Span {
|
fn span_open(&mut self, group: &Self::Group) -> Self::Span {
|
||||||
// FIXME handle span
|
// FIXME we only store one `TokenId` for the delimiters
|
||||||
// MySpan(self.span_interner.intern(&MySpanData(group.span_open())))
|
group.delimiter.map(|it| it.id).unwrap_or_else(tt::TokenId::unspecified)
|
||||||
tt::TokenId::unspecified()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn span_close(&mut self, _group: &Self::Group) -> Self::Span {
|
fn span_close(&mut self, group: &Self::Group) -> Self::Span {
|
||||||
// FIXME handle span
|
// FIXME we only store one `TokenId` for the delimiters
|
||||||
tt::TokenId::unspecified()
|
group.delimiter.map(|it| it.id).unwrap_or_else(tt::TokenId::unspecified)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,13 +454,11 @@ impl server::Punct for Rustc {
|
||||||
fn spacing(&mut self, punct: Self::Punct) -> bridge::Spacing {
|
fn spacing(&mut self, punct: Self::Punct) -> bridge::Spacing {
|
||||||
spacing_to_external(punct.spacing)
|
spacing_to_external(punct.spacing)
|
||||||
}
|
}
|
||||||
fn span(&mut self, _punct: Self::Punct) -> Self::Span {
|
fn span(&mut self, punct: Self::Punct) -> Self::Span {
|
||||||
// FIXME handle span
|
punct.id
|
||||||
tt::TokenId::unspecified()
|
|
||||||
}
|
}
|
||||||
fn with_span(&mut self, punct: Self::Punct, _span: Self::Span) -> Self::Punct {
|
fn with_span(&mut self, punct: Self::Punct, span: Self::Span) -> Self::Punct {
|
||||||
// FIXME handle span
|
tt::Punct { id: span, ..punct }
|
||||||
punct
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,13 +472,13 @@ impl server::Ident for Rustc {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn span(&mut self, _ident: Self::Ident) -> Self::Span {
|
fn span(&mut self, ident: Self::Ident) -> Self::Span {
|
||||||
// FIXME handle span
|
self.ident_interner.get(ident.0).0.id
|
||||||
tt::TokenId::unspecified()
|
|
||||||
}
|
}
|
||||||
fn with_span(&mut self, ident: Self::Ident, _span: Self::Span) -> Self::Ident {
|
fn with_span(&mut self, ident: Self::Ident, span: Self::Span) -> Self::Ident {
|
||||||
// FIXME handle span
|
let data = self.ident_interner.get(ident.0);
|
||||||
ident
|
let new = IdentData(tt::Ident { id: span, ..data.0.clone() });
|
||||||
|
IdentId(self.ident_interner.intern(&new))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue