Skip to content

Commit 9bd5e31

Browse files
committed
chore: rename LocatedDirective.opener_start to .comment_start
1 parent 38f36f7 commit 9bd5e31

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

crates/lingui_macro/src/comment_directive/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ enum CommentKind {
9494
#[derive(Debug, PartialEq, Eq)]
9595
struct LocatedDirective<'a> {
9696
/// Byte offset of the comment opener (`//`, `/*` or `/**`) introducing it.
97-
opener_start: usize,
97+
comment_start: usize,
9898
/// Byte offset just past the comment (after `*/`, the newline, or EOF).
9999
comment_end: usize,
100100
reset: bool,
@@ -133,7 +133,7 @@ fn locate_directives(source: &str) -> Vec<LocatedDirective<'_>> {
133133
}
134134
}
135135

136-
let Some((opener_start, kind)) = find_comment_opener(source, keyword) else {
136+
let Some((comment_start, kind)) = find_comment_opener(source, keyword) else {
137137
continue;
138138
};
139139

@@ -149,7 +149,7 @@ fn locate_directives(source: &str) -> Vec<LocatedDirective<'_>> {
149149
};
150150

151151
out.push(LocatedDirective {
152-
opener_start,
152+
comment_start,
153153
comment_end,
154154
reset,
155155
params,
@@ -293,7 +293,7 @@ fn collect_lingui_directives_from_source(source: &str, start_pos: BytePos) -> Ve
293293
let mut accumulated = DirectiveValues::default();
294294

295295
for located in locate_directives(source) {
296-
let comment_start = BytePos(start_pos.0 + located.opener_start as u32);
296+
let comment_start = BytePos(start_pos.0 + located.comment_start as u32);
297297

298298
match parse_lingui_directive(located.reset, located.params) {
299299
Ok(parsed) => {

crates/lingui_macro/src/comment_directive/tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ fn locate_multiple_directives_in_order() {
131131
}
132132

133133
#[test]
134-
fn locate_records_opener_start_offset() {
135-
// Opener offset points at the `/` of the introducing comment, even when
136-
// preceded by code (e.g. a JSX expression container).
134+
fn locate_records_comment_start_offset() {
135+
// Comment start offset points at the `/` of the introducing comment, even
136+
// when preceded by code (e.g. a JSX expression container).
137137
let dirs = locate_directives("<div>{/* lingui-reset */}</div>");
138138
assert_eq!(dirs.len(), 1);
139-
assert_eq!(dirs[0].opener_start, 6); // position of `/*`
139+
assert_eq!(dirs[0].comment_start, 6); // position of `/*`
140140
}
141141

142142
#[test]

0 commit comments

Comments
 (0)