Skip to content

Commit 5368e18

Browse files
authoredAug 1, 2024··
fix(common): Fix StringInput.end_pos (#9362)
1 parent dd4b782 commit 5368e18

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
 

‎.changeset/pink-pianos-allow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
swc_common: patch
3+
---
4+
5+
fix(common): Fix `StringInput.end_pos`

‎crates/swc_common/src/input.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct StringInput<'a> {
1515
orig: &'a str,
1616
/// Original start position.
1717
orig_start: BytePos,
18+
orig_end: BytePos,
1819
}
1920

2021
impl<'a> StringInput<'a> {
@@ -34,6 +35,7 @@ impl<'a> StringInput<'a> {
3435
orig: src,
3536
iter: src.chars(),
3637
orig_start: start,
38+
orig_end: end,
3739
}
3840
}
3941

@@ -55,7 +57,7 @@ impl<'a> StringInput<'a> {
5557
}
5658

5759
pub fn end_pos(&self) -> BytePos {
58-
self.last_pos
60+
self.orig_end
5961
}
6062
}
6163

0 commit comments

Comments
 (0)
Please sign in to comment.