svlog: ast: Add order() to AnyNode
@@ -18,6 +18,9 @@ pub trait AnyNode<'a>: BasicNode<'a> + std::fmt::Binary {
/// Get this node's span in the input.
fn span(&self) -> Span;
+ /// Get this node's lexical order.
+ fn order(&self) -> usize;
+
/// Get this node's parent.
fn get_parent(&self) -> Option<&'a dyn AnyNode<'a>> {
None
@@ -166,6 +169,10 @@ where
self.span
}
+ fn order(&self) -> usize {
+ self.order.get()
+ }
+
fn get_parent(&self) -> Option<&'a dyn AnyNode<'a>> {
self.parent.get()
}
