mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
add name resolution from the old impl
unlike the old impl, this also handles macro imports across crates
This commit is contained in:
parent
0d8d918656
commit
182c05a96c
9 changed files with 743 additions and 189 deletions
|
@ -114,6 +114,9 @@ pub trait AttrsOwner: AstNode {
|
|||
fn attrs(&self) -> AstChildren<Attr> {
|
||||
children(self)
|
||||
}
|
||||
fn has_atom_attr(&self, atom: &str) -> bool {
|
||||
self.attrs().filter_map(|x| x.as_atom()).any(|x| x == atom)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait DocCommentsOwner: AstNode {
|
||||
|
@ -153,12 +156,6 @@ pub trait DocCommentsOwner: AstNode {
|
|||
}
|
||||
}
|
||||
|
||||
impl FnDef {
|
||||
pub fn has_atom_attr(&self, atom: &str) -> bool {
|
||||
self.attrs().filter_map(|x| x.as_atom()).any(|x| x == atom)
|
||||
}
|
||||
}
|
||||
|
||||
impl Attr {
|
||||
pub fn is_inner(&self) -> bool {
|
||||
let tt = match self.value() {
|
||||
|
|
|
@ -2108,6 +2108,7 @@ impl ToOwned for MacroCall {
|
|||
|
||||
|
||||
impl ast::NameOwner for MacroCall {}
|
||||
impl ast::AttrsOwner for MacroCall {}
|
||||
impl MacroCall {
|
||||
pub fn token_tree(&self) -> Option<&TokenTree> {
|
||||
super::child_opt(self)
|
||||
|
|
|
@ -557,7 +557,7 @@ Grammar(
|
|||
"Name": (),
|
||||
"NameRef": (),
|
||||
"MacroCall": (
|
||||
traits: [ "NameOwner" ],
|
||||
traits: [ "NameOwner", "AttrsOwner" ],
|
||||
options: [ "TokenTree", "Path" ],
|
||||
),
|
||||
"Attr": ( options: [ ["value", "TokenTree"] ] ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue