aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast.rs6
-rw-r--r--crates/ra_syntax/src/ast/generated.rs6
-rw-r--r--crates/ra_syntax/src/grammar.ron2
3 files changed, 12 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index 123a7a6b9..8bf439b60 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -348,6 +348,12 @@ impl UseTreeList {
348 } 348 }
349} 349}
350 350
351impl RefPat {
352 pub fn is_mut(&self) -> bool {
353 self.syntax().children().any(|n| n.kind() == MUT_KW)
354 }
355}
356
351fn child_opt<P: AstNode, C: AstNode>(parent: &P) -> Option<&C> { 357fn child_opt<P: AstNode, C: AstNode>(parent: &P) -> Option<&C> {
352 children(parent).next() 358 children(parent).next()
353} 359}
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 1f6055115..f745cb1cb 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -2456,7 +2456,11 @@ impl AstNode for RefPat {
2456} 2456}
2457 2457
2458 2458
2459impl RefPat {} 2459impl RefPat {
2460 pub fn pat(&self) -> Option<&Pat> {
2461 super::child_opt(self)
2462 }
2463}
2460 2464
2461// ReferenceType 2465// ReferenceType
2462#[derive(Debug, PartialEq, Eq, Hash)] 2466#[derive(Debug, PartialEq, Eq, Hash)]
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index bddd96a5c..bac62fa04 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -462,7 +462,7 @@ Grammar(
462 ], 462 ],
463 ), 463 ),
464 464
465 "RefPat": (), 465 "RefPat": ( options: [ "Pat" ]),
466 "BindPat": ( traits: ["NameOwner"] ), 466 "BindPat": ( traits: ["NameOwner"] ),
467 "PlaceholderPat": (), 467 "PlaceholderPat": (),
468 "PathPat": (), 468 "PathPat": (),