parent
1c77a1fa3c
commit
e62a543344
8 changed files with 216 additions and 231 deletions
|
@ -1139,6 +1139,14 @@ impl Expr {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn peel_parens(&self) -> &Expr {
|
||||
let mut expr = self;
|
||||
while let ExprKind::Paren(inner) = &expr.kind {
|
||||
expr = &inner;
|
||||
}
|
||||
expr
|
||||
}
|
||||
|
||||
/// Attempts to reparse as `Ty` (for diagnostic purposes).
|
||||
pub fn to_ty(&self) -> Option<P<Ty>> {
|
||||
let kind = match &self.kind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue