More precise spans for HIR paths
This commit is contained in:
parent
2ccf06302c
commit
7e66e9d6b0
22 changed files with 60 additions and 30 deletions
|
@ -149,9 +149,17 @@ impl PathSegment {
|
|||
pub fn from_ident(ident: Ident) -> Self {
|
||||
PathSegment { ident, id: DUMMY_NODE_ID, args: None }
|
||||
}
|
||||
|
||||
pub fn path_root(span: Span) -> Self {
|
||||
PathSegment::from_ident(Ident::new(kw::PathRoot, span))
|
||||
}
|
||||
|
||||
pub fn span(&self) -> Span {
|
||||
match &self.args {
|
||||
Some(args) => self.ident.span.to(args.span()),
|
||||
None => self.ident.span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The arguments of a path segment.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue