diff options
author | Aleksey Kladov <[email protected]> | 2018-08-14 11:33:44 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-14 11:33:44 +0100 |
commit | 1141d448d960eedba0a5647d525910de706bf778 (patch) | |
tree | 144842663edc382addc6b2cb115717d5bb7eb736 /crates/libsyntax2/src/ast | |
parent | 5953a348bd6102a868f303d3f732a6ec7d465833 (diff) |
Add derive intention
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs | 25 |
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 | ||
268 | impl<R: TreeRoot> NeverType<R> {} | 268 | impl<R: TreeRoot> NeverType<R> {} |
269 | 269 | ||
270 | // NominalDef | ||
271 | #[derive(Debug, Clone, Copy)] | ||
272 | pub enum NominalDef<R: TreeRoot = Arc<SyntaxRoot>> { | ||
273 | StructDef(StructDef<R>), | ||
274 | EnumDef(EnumDef<R>), | ||
275 | } | ||
276 | |||
277 | impl<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 | |||
293 | impl<R: TreeRoot> NominalDef<R> {} | ||
294 | |||
270 | // ParenType | 295 | // ParenType |
271 | #[derive(Debug, Clone, Copy)] | 296 | #[derive(Debug, Clone, Copy)] |
272 | pub struct ParenType<R: TreeRoot = Arc<SyntaxRoot>> { | 297 | pub struct ParenType<R: TreeRoot = Arc<SyntaxRoot>> { |