Skip to content

Commit d54d50d

Browse files
committed
Rename macro descension functions
1 parent 6406490 commit d54d50d

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

crates/hir/src/semantics.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ impl<'db> SemanticsImpl<'db> {
550550
string: &ast::String,
551551
) -> Option<Vec<(TextRange, Option<PathResolution>)>> {
552552
let quote = string.open_quote_text_range()?;
553-
self.descend_into_macros_ng_b(string.syntax().clone(), |token| {
553+
self.descend_into_macros_breakable(string.syntax().clone(), |token| {
554554
(|| {
555555
let token = token.value;
556556
let string = ast::String::cast(token)?;
@@ -577,7 +577,7 @@ impl<'db> SemanticsImpl<'db> {
577577
) -> Option<(TextRange, Option<PathResolution>)> {
578578
let original_string = ast::String::cast(original_token.clone())?;
579579
let quote = original_string.open_quote_text_range()?;
580-
self.descend_into_macros_ng_b(original_token.clone(), |token| {
580+
self.descend_into_macros_breakable(original_token.clone(), |token| {
581581
(|| {
582582
let token = token.value;
583583
self.resolve_offset_in_format_args(
@@ -664,7 +664,7 @@ impl<'db> SemanticsImpl<'db> {
664664
res
665665
}
666666

667-
pub fn descend_into_macros_ng(
667+
pub fn descend_into_macros_cb(
668668
&self,
669669
token: SyntaxToken,
670670
mut cb: impl FnMut(InFile<SyntaxToken>),
@@ -675,7 +675,7 @@ impl<'db> SemanticsImpl<'db> {
675675
});
676676
}
677677

678-
pub fn descend_into_macros_ng_v(&self, token: SyntaxToken) -> SmallVec<[SyntaxToken; 1]> {
678+
pub fn descend_into_macros(&self, token: SyntaxToken) -> SmallVec<[SyntaxToken; 1]> {
679679
let mut res = smallvec![];
680680
self.descend_into_macros_impl(token.clone(), &mut |t| {
681681
res.push(t.value);
@@ -687,7 +687,7 @@ impl<'db> SemanticsImpl<'db> {
687687
res
688688
}
689689

690-
pub fn descend_into_macros_ng_b<T>(
690+
pub fn descend_into_macros_breakable<T>(
691691
&self,
692692
token: SyntaxToken,
693693
mut cb: impl FnMut(InFile<SyntaxToken>) -> ControlFlow<T>,
@@ -702,7 +702,7 @@ impl<'db> SemanticsImpl<'db> {
702702
let text = token.text();
703703
let kind = token.kind();
704704

705-
self.descend_into_macros_ng(token.clone(), |InFile { value, file_id: _ }| {
705+
self.descend_into_macros_cb(token.clone(), |InFile { value, file_id: _ }| {
706706
let mapped_kind = value.kind();
707707
let any_ident_match = || kind.is_any_identifier() && value.kind().is_any_identifier();
708708
let matches = (kind == mapped_kind || any_ident_match()) && text == value.text();
@@ -722,7 +722,7 @@ impl<'db> SemanticsImpl<'db> {
722722
let text = token.text();
723723
let kind = token.kind();
724724

725-
self.descend_into_macros_ng_b(token.clone(), |InFile { value, file_id: _ }| {
725+
self.descend_into_macros_breakable(token.clone(), |InFile { value, file_id: _ }| {
726726
let mapped_kind = value.kind();
727727
let any_ident_match = || kind.is_any_identifier() && value.kind().is_any_identifier();
728728
let matches = (kind == mapped_kind || any_ident_match()) && text == value.text();

crates/ide/src/doc_links.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl DocCommentToken {
286286
let original_start = doc_token.text_range().start();
287287
let relative_comment_offset = offset - original_start - prefix_len;
288288

289-
sema.descend_into_macros_ng_v(doc_token).into_iter().find_map(|t| {
289+
sema.descend_into_macros(doc_token).into_iter().find_map(|t| {
290290
let (node, descended_prefix_len) = match_ast! {
291291
match t {
292292
ast::Comment(comment) => (t.parent()?, TextSize::try_from(comment.prefix().len()).ok()?),

crates/ide/src/goto_declaration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(crate) fn goto_declaration(
2929
.find(|it| matches!(it.kind(), IDENT | T![self] | T![super] | T![crate] | T![Self]))?;
3030
let range = original_token.text_range();
3131
let info: Vec<NavigationTarget> = sema
32-
.descend_into_macros_ng_v(original_token)
32+
.descend_into_macros(original_token)
3333
.iter()
3434
.filter_map(|token| {
3535
let parent = token.parent()?;

crates/ide/src/goto_definition.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub(crate) fn goto_definition(
8383
}
8484

8585
let navs = sema
86-
.descend_into_macros_ng_v(original_token.clone())
86+
.descend_into_macros(original_token.clone())
8787
.into_iter()
8888
.filter_map(|token| {
8989
let parent = token.parent()?;
@@ -248,10 +248,7 @@ pub(crate) fn find_fn_or_blocks(
248248
None
249249
};
250250

251-
sema.descend_into_macros_ng_v(token.clone())
252-
.into_iter()
253-
.filter_map(find_ancestors)
254-
.collect_vec()
251+
sema.descend_into_macros(token.clone()).into_iter().filter_map(find_ancestors).collect_vec()
255252
}
256253

257254
fn nav_for_exit_points(
@@ -366,7 +363,7 @@ pub(crate) fn find_loops(
366363
None
367364
};
368365

369-
sema.descend_into_macros_ng_v(token.clone())
366+
sema.descend_into_macros(token.clone())
370367
.into_iter()
371368
.filter_map(find_ancestors)
372369
.collect_vec()

crates/ide/src/goto_type_definition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub(crate) fn goto_type_definition(
6969
}
7070

7171
let range = token.text_range();
72-
sema.descend_into_macros_ng_v(token)
72+
sema.descend_into_macros(token)
7373
.into_iter()
7474
.filter_map(|token| {
7575
let ty = sema

crates/ide/src/hover.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn hover_simple(
181181
// prefer descending the same token kind in attribute expansions, in normal macros text
182182
// equivalency is more important
183183
let mut descended = vec![];
184-
sema.descend_into_macros_ng(original_token.clone(), |token| {
184+
sema.descend_into_macros_cb(original_token.clone(), |token| {
185185
descended.push(token.value);
186186
});
187187
let descended = || descended.iter();

crates/ide/src/syntax_highlighting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ fn traverse(
409409
let mut r = 0;
410410
// FIXME: Add an extra API that takes the file id of this. That is a simple way
411411
// to prevent us constantly walking up the tree to fetch the file
412-
sema.descend_into_macros_ng_b(token.clone(), |tok| {
412+
sema.descend_into_macros_breakable(token.clone(), |tok| {
413413
let tok = tok.value;
414414
let tok_kind = tok.kind();
415415

0 commit comments

Comments
 (0)