mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Add derive intention
This commit is contained in:
parent
5953a348bd
commit
1141d448d9
6 changed files with 114 additions and 187 deletions
|
@ -267,6 +267,31 @@ impl<R: TreeRoot> AstNode<R> for NeverType<R> {
|
|||
|
||||
impl<R: TreeRoot> NeverType<R> {}
|
||||
|
||||
// NominalDef
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum NominalDef<R: TreeRoot = Arc<SyntaxRoot>> {
|
||||
StructDef(StructDef<R>),
|
||||
EnumDef(EnumDef<R>),
|
||||
}
|
||||
|
||||
impl<R: TreeRoot> AstNode<R> for NominalDef<R> {
|
||||
fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
|
||||
match syntax.kind() {
|
||||
STRUCT_DEF => Some(NominalDef::StructDef(StructDef { syntax })),
|
||||
ENUM_DEF => Some(NominalDef::EnumDef(EnumDef { syntax })),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxNode<R> {
|
||||
match self {
|
||||
NominalDef::StructDef(inner) => inner.syntax(),
|
||||
NominalDef::EnumDef(inner) => inner.syntax(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: TreeRoot> NominalDef<R> {}
|
||||
|
||||
// ParenType
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct ParenType<R: TreeRoot = Arc<SyntaxRoot>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue