aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/ast
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-14 11:33:44 +0100
committerAleksey Kladov <[email protected]>2018-08-14 11:33:44 +0100
commit1141d448d960eedba0a5647d525910de706bf778 (patch)
tree144842663edc382addc6b2cb115717d5bb7eb736 /crates/libsyntax2/src/ast
parent5953a348bd6102a868f303d3f732a6ec7d465833 (diff)
Add derive intention
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs
index 3e6c673ab..80670ce71 100644
--- a/crates/libsyntax2/src/ast/generated.rs
+++ b/crates/libsyntax2/src/ast/generated.rs
@@ -267,6 +267,31 @@ impl<R: TreeRoot> AstNode<R> for NeverType<R> {
267 267
268impl<R: TreeRoot> NeverType<R> {} 268impl<R: TreeRoot> NeverType<R> {}
269 269
270// NominalDef
271#[derive(Debug, Clone, Copy)]
272pub enum NominalDef<R: TreeRoot = Arc<SyntaxRoot>> {
273 StructDef(StructDef<R>),
274 EnumDef(EnumDef<R>),
275}
276
277impl<R: TreeRoot> AstNode<R> for NominalDef<R> {
278 fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
279 match syntax.kind() {
280 STRUCT_DEF => Some(NominalDef::StructDef(StructDef { syntax })),
281 ENUM_DEF => Some(NominalDef::EnumDef(EnumDef { syntax })),
282 _ => None,
283 }
284 }
285 fn syntax(&self) -> &SyntaxNode<R> {
286 match self {
287 NominalDef::StructDef(inner) => inner.syntax(),
288 NominalDef::EnumDef(inner) => inner.syntax(),
289 }
290 }
291}
292
293impl<R: TreeRoot> NominalDef<R> {}
294
270// ParenType 295// ParenType
271#[derive(Debug, Clone, Copy)] 296#[derive(Debug, Clone, Copy)]
272pub struct ParenType<R: TreeRoot = Arc<SyntaxRoot>> { 297pub struct ParenType<R: TreeRoot = Arc<SyntaxRoot>> {