mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-30 15:17:31 +00:00
Move AttrsOwnerNode
to syntax and make it public
This commit is contained in:
parent
fc21640a65
commit
fc5f73de45
3 changed files with 33 additions and 33 deletions
|
@ -90,6 +90,36 @@ impl NameOwner for Macro {
|
|||
|
||||
impl AttrsOwner for Macro {}
|
||||
|
||||
/// Basically an owned `dyn AttrsOwner` without extra boxing.
|
||||
pub struct AttrsOwnerNode {
|
||||
node: SyntaxNode,
|
||||
}
|
||||
|
||||
impl AttrsOwnerNode {
|
||||
pub fn new<N: AttrsOwner>(node: N) -> Self {
|
||||
AttrsOwnerNode { node: node.syntax().clone() }
|
||||
}
|
||||
}
|
||||
|
||||
impl AttrsOwner for AttrsOwnerNode {}
|
||||
impl AstNode for AttrsOwnerNode {
|
||||
fn can_cast(_: SyntaxKind) -> bool
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
false
|
||||
}
|
||||
fn cast(_: SyntaxNode) -> Option<Self>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
None
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxNode {
|
||||
&self.node
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum AttrKind {
|
||||
Inner,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue