Give each PathSegment a NodeId

This commit is contained in:
Nick Cameron 2018-08-31 12:01:26 +12:00
parent 8ec22e7ec7
commit fc67d8fac4
4 changed files with 19 additions and 7 deletions

View file

@ -129,6 +129,8 @@ pub struct PathSegment {
/// The identifier portion of this path segment.
pub ident: Ident,
pub id: NodeId,
/// Type/lifetime parameters attached to this path. They come in
/// two flavors: `Path<A,B,C>` and `Path(A,B) -> C`.
/// `None` means that no parameter list is supplied (`Path`),
@ -140,10 +142,14 @@ pub struct PathSegment {
impl PathSegment {
pub fn from_ident(ident: Ident) -> Self {
PathSegment { ident, args: None }
PathSegment { ident, id: DUMMY_NODE_ID, args: None }
}
pub fn crate_root(span: Span) -> Self {
PathSegment::from_ident(Ident::new(keywords::CrateRoot.name(), span))
PathSegment {
ident: Ident::new(keywords::CrateRoot.name(), span),
id: CRATE_NODE_ID,
args: None,
}
}
}