diff options
author | Seivan Heidari <[email protected]> | 2019-12-23 14:35:31 +0000 |
---|---|---|
committer | Seivan Heidari <[email protected]> | 2019-12-23 14:35:31 +0000 |
commit | b21d9337d9200e2cfdc90b386591c72c302dc03e (patch) | |
tree | f81f5c08f821115cee26fa4d3ceaae88c7807fd5 /crates/ra_syntax/src/ast/generated.rs | |
parent | 18a0937585b836ec5ed054b9ae48e0156ab6d9ef (diff) | |
parent | ce07a2daa9e53aa86a769f8641b14c2878444fbc (diff) |
Merge branch 'master' into feature/themes
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index c06076e3d..9f9d6e63c 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -312,6 +312,7 @@ impl AstNode for Block { | |||
312 | } | 312 | } |
313 | } | 313 | } |
314 | impl ast::AttrsOwner for Block {} | 314 | impl ast::AttrsOwner for Block {} |
315 | impl ast::ModuleItemOwner for Block {} | ||
315 | impl Block { | 316 | impl Block { |
316 | pub fn statements(&self) -> AstChildren<Stmt> { | 317 | pub fn statements(&self) -> AstChildren<Stmt> { |
317 | AstChildren::new(&self.syntax) | 318 | AstChildren::new(&self.syntax) |
@@ -550,6 +551,36 @@ impl ConstDef { | |||
550 | } | 551 | } |
551 | } | 552 | } |
552 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 553 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
554 | pub struct ConstParam { | ||
555 | pub(crate) syntax: SyntaxNode, | ||
556 | } | ||
557 | impl AstNode for ConstParam { | ||
558 | fn can_cast(kind: SyntaxKind) -> bool { | ||
559 | match kind { | ||
560 | CONST_PARAM => true, | ||
561 | _ => false, | ||
562 | } | ||
563 | } | ||
564 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
565 | if Self::can_cast(syntax.kind()) { | ||
566 | Some(Self { syntax }) | ||
567 | } else { | ||
568 | None | ||
569 | } | ||
570 | } | ||
571 | fn syntax(&self) -> &SyntaxNode { | ||
572 | &self.syntax | ||
573 | } | ||
574 | } | ||
575 | impl ast::NameOwner for ConstParam {} | ||
576 | impl ast::AttrsOwner for ConstParam {} | ||
577 | impl ast::TypeAscriptionOwner for ConstParam {} | ||
578 | impl ConstParam { | ||
579 | pub fn default_val(&self) -> Option<Expr> { | ||
580 | AstChildren::new(&self.syntax).next() | ||
581 | } | ||
582 | } | ||
583 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
553 | pub struct ContinueExpr { | 584 | pub struct ContinueExpr { |
554 | pub(crate) syntax: SyntaxNode, | 585 | pub(crate) syntax: SyntaxNode, |
555 | } | 586 | } |
@@ -1425,6 +1456,9 @@ impl LambdaExpr { | |||
1425 | pub fn param_list(&self) -> Option<ParamList> { | 1456 | pub fn param_list(&self) -> Option<ParamList> { |
1426 | AstChildren::new(&self.syntax).next() | 1457 | AstChildren::new(&self.syntax).next() |
1427 | } | 1458 | } |
1459 | pub fn ret_type(&self) -> Option<RetType> { | ||
1460 | AstChildren::new(&self.syntax).next() | ||
1461 | } | ||
1428 | pub fn body(&self) -> Option<Expr> { | 1462 | pub fn body(&self) -> Option<Expr> { |
1429 | AstChildren::new(&self.syntax).next() | 1463 | AstChildren::new(&self.syntax).next() |
1430 | } | 1464 | } |