mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-07 20:43:03 +00:00
get matches from code.descendants
This commit is contained in:
parent
94603d9848
commit
b1ee6d17a4
@ -223,15 +223,17 @@ fn find(pattern: &SsrPattern, code: &SyntaxNode) -> SsrMatches {
|
|||||||
}
|
}
|
||||||
let kind = pattern.pattern.kind();
|
let kind = pattern.pattern.kind();
|
||||||
let matches = code
|
let matches = code
|
||||||
.descendants_with_tokens()
|
.descendants()
|
||||||
.filter(|n| n.kind() == kind)
|
.filter(|n| n.kind() == kind)
|
||||||
.filter_map(|code| {
|
.filter_map(|code| {
|
||||||
let match_ = Match {
|
let match_ =
|
||||||
place: code.as_node().unwrap().clone(),
|
Match { place: code.clone(), binding: HashMap::new(), ignored_comments: vec![] };
|
||||||
binding: HashMap::new(),
|
check(
|
||||||
ignored_comments: vec![],
|
&SyntaxElement::from(pattern.pattern.clone()),
|
||||||
};
|
&SyntaxElement::from(code),
|
||||||
check(&SyntaxElement::from(pattern.pattern.clone()), &code, &pattern.vars, match_)
|
&pattern.vars,
|
||||||
|
match_,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
SsrMatches { matches }
|
SsrMatches { matches }
|
||||||
|
Loading…
Reference in New Issue
Block a user