Skip to content
This repository was archived by the owner on May 11, 2023. It is now read-only.

Commit ab6e9d1

Browse files
committed
Document Located
1 parent e24f132 commit ab6e9d1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/ast/src/ast_gen.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ impl<T, U> Located<T, U> {
2727
}
2828
}
2929

30+
/// Creates a new node that spans the position specified by `range`.
3031
pub fn with_range(node: T, range: TextRange) -> Self
3132
where
3233
U: Default,
@@ -38,6 +39,7 @@ impl<T, U> Located<T, U> {
3839
}
3940
}
4041

42+
/// Returns the absolute start position of the node from the beginning of the document.
4143
#[inline]
4244
pub const fn start(&self) -> TextSize {
4345
self.range.start()
@@ -48,11 +50,13 @@ impl<T, U> Located<T, U> {
4850
&self.custom
4951
}
5052

53+
/// Returns the node
5154
#[inline]
5255
pub fn node(&self) -> &T {
5356
&self.node
5457
}
5558

59+
/// Consumes self and returns the node.
5660
#[inline]
5761
pub fn into_node(self) -> T {
5862
self.node
@@ -63,11 +67,13 @@ impl<T, U> Located<T, U> {
6367
self.custom
6468
}
6569

70+
/// Returns the `range` of the node. The range offsets are absolute to the start of the document.
6671
#[inline]
6772
pub const fn range(&self) -> TextRange {
6873
self.range
6974
}
7075

76+
/// Returns the absolute position at which the node ends in the source document.
7177
#[inline]
7278
pub const fn end(&self) -> TextSize {
7379
self.range.end()

0 commit comments

Comments
 (0)