Add id to Node

This commit is contained in:
Pranav Gaddamadugu 2023-08-09 09:30:01 -04:00
parent d654182095
commit 6ab280a935

View File

@ -25,6 +25,12 @@ pub trait Node:
/// Sets the span of the node.
fn set_span(&mut self, span: Span);
/// Returns the ID of the node.
fn id(&self) -> usize;
/// Sets the ID of the node.
fn set_id(&mut self, id: usize);
}
#[macro_export]
@ -38,6 +44,14 @@ macro_rules! simple_node_impl {
fn set_span(&mut self, span: Span) {
self.span = span;
}
fn id(&self) -> usize {
self.id
}
fn set_id(&mut self, id: usize) {
self.id = id;
}
}
};
}