mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
internal: Refactor our record pat/expr handling in completion context
This commit is contained in:
parent
697ade6f8d
commit
6a8b8a6039
9 changed files with 151 additions and 125 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue