summaryrefslogtreecommitdiff
path: root/src/syntax
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-09-21 17:50:58 +0200
committerLaurenz <laurmaedje@gmail.com>2022-09-21 20:25:57 +0200
commitddd3b6a82b8c0353c942bfba8b89ca5476eedc58 (patch)
treea64c350f0f1f82152ff18cfb02fbfdbf39292672 /src/syntax
parent3760748fddd3b793c79c370398a9d4a3fc5afc04 (diff)
Tracked memoization
Diffstat (limited to 'src/syntax')
-rw-r--r--src/syntax/span.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/syntax/span.rs b/src/syntax/span.rs
index 4eae4124..59c4cc5c 100644
--- a/src/syntax/span.rs
+++ b/src/syntax/span.rs
@@ -81,7 +81,7 @@ impl Span {
"span number outside valid range"
);
- let bits = ((id.into_raw() as u64) << Self::BITS) | number;
+ let bits = ((id.into_u16() as u64) << Self::BITS) | number;
Self(to_non_zero(bits))
}
@@ -98,7 +98,7 @@ impl Span {
/// The id of the source file the span points into.
pub const fn source(self) -> SourceId {
- SourceId::from_raw((self.0.get() >> Self::BITS) as u16)
+ SourceId::from_u16((self.0.get() >> Self::BITS) as u16)
}
/// The unique number of the span within the source file.
@@ -157,7 +157,7 @@ mod tests {
#[test]
fn test_span_encoding() {
- let id = SourceId::from_raw(5);
+ let id = SourceId::from_u16(5);
let span = Span::new(id, 10).with_pos(SpanPos::End);
assert_eq!(span.source(), id);
assert_eq!(span.number(), 10);