Add ast::ExprKind::Dummy

This commit is contained in:
Lieselotte 2024-02-25 22:22:09 +01:00
parent 8c0b1fcd29
commit a3fce72a27
No known key found for this signature in database
GPG key ID: 43A6A32F83A6F9B1
18 changed files with 37 additions and 24 deletions

View file

@ -1296,23 +1296,10 @@ impl Expr {
ExprKind::Yeet(..) => ExprPrecedence::Yeet,
ExprKind::FormatArgs(..) => ExprPrecedence::FormatArgs,
ExprKind::Become(..) => ExprPrecedence::Become,
ExprKind::Err => ExprPrecedence::Err,
ExprKind::Err | ExprKind::Dummy => ExprPrecedence::Err,
}
}
pub fn take(&mut self) -> Self {
mem::replace(
self,
Expr {
id: DUMMY_NODE_ID,
kind: ExprKind::Err,
span: DUMMY_SP,
attrs: AttrVec::new(),
tokens: None,
},
)
}
/// To a first-order approximation, is this a pattern?
pub fn is_approximately_pattern(&self) -> bool {
matches!(
@ -1532,6 +1519,9 @@ pub enum ExprKind {
/// Placeholder for an expression that wasn't syntactically well formed in some way.
Err,
/// Acts as a null expression. Lowering it will always emit a bug.
Dummy,
}
/// Used to differentiate between `for` loops and `for await` loops.