aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorroblabla <[email protected]>2019-12-22 00:38:23 +0000
committerroblabla <[email protected]>2019-12-22 01:32:08 +0000
commitb04d4a88d1ba7f04445e807b6a816930b1e9bbf2 (patch)
tree2c05ff9b5f5aadc7338c6ba317b28c4d12ce9f7c /crates/ra_syntax/src/ast
parent90f3b31efc1afe5de671fd6076fef3240f4151ab (diff)
Parse const generics
Fixes #1574 Fixes #2281
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 9dd6bd3ea..b917f77fe 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -551,6 +551,36 @@ impl ConstDef {
551 } 551 }
552} 552}
553#[derive(Debug, Clone, PartialEq, Eq, Hash)] 553#[derive(Debug, Clone, PartialEq, Eq, Hash)]
554pub struct ConstParam {
555 pub(crate) syntax: SyntaxNode,
556}
557impl 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}
575impl ast::NameOwner for ConstParam {}
576impl ast::AttrsOwner for ConstParam {}
577impl ast::TypeAscriptionOwner for ConstParam {}
578impl ConstParam {
579 pub fn default_val(&self) -> Option<Expr> {
580 AstChildren::new(&self.syntax).next()
581 }
582}
583#[derive(Debug, Clone, PartialEq, Eq, Hash)]
554pub struct ContinueExpr { 584pub struct ContinueExpr {
555 pub(crate) syntax: SyntaxNode, 585 pub(crate) syntax: SyntaxNode,
556} 586}