Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
| -rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index b7bf45c04c..2a41d0a701 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -510,6 +510,10 @@ impl ast::RecordPatField { } } + pub fn parent_record_pat(&self) -> ast::RecordPat { + self.syntax().ancestors().find_map(ast::RecordPat::cast).unwrap() + } + /// Deals with field init shorthand pub fn field_name(&self) -> Option<NameOrNameRef> { if let Some(name_ref) = self.name_ref() { |