hir
: Add Become
expression kind
This commit is contained in:
parent
97bf23d26b
commit
ccb71ff424
28 changed files with 268 additions and 72 deletions
|
@ -1719,6 +1719,7 @@ impl Expr<'_> {
|
|||
ExprKind::Break(..) => ExprPrecedence::Break,
|
||||
ExprKind::Continue(..) => ExprPrecedence::Continue,
|
||||
ExprKind::Ret(..) => ExprPrecedence::Ret,
|
||||
ExprKind::Become(..) => ExprPrecedence::Become,
|
||||
ExprKind::InlineAsm(..) => ExprPrecedence::InlineAsm,
|
||||
ExprKind::OffsetOf(..) => ExprPrecedence::OffsetOf,
|
||||
ExprKind::Struct(..) => ExprPrecedence::Struct,
|
||||
|
@ -1776,6 +1777,7 @@ impl Expr<'_> {
|
|||
| ExprKind::Break(..)
|
||||
| ExprKind::Continue(..)
|
||||
| ExprKind::Ret(..)
|
||||
| ExprKind::Become(..)
|
||||
| ExprKind::Let(..)
|
||||
| ExprKind::Loop(..)
|
||||
| ExprKind::Assign(..)
|
||||
|
@ -1866,6 +1868,7 @@ impl Expr<'_> {
|
|||
| ExprKind::Break(..)
|
||||
| ExprKind::Continue(..)
|
||||
| ExprKind::Ret(..)
|
||||
| ExprKind::Become(..)
|
||||
| ExprKind::Let(..)
|
||||
| ExprKind::Loop(..)
|
||||
| ExprKind::Assign(..)
|
||||
|
@ -2025,6 +2028,8 @@ pub enum ExprKind<'hir> {
|
|||
Continue(Destination),
|
||||
/// A `return`, with an optional value to be returned.
|
||||
Ret(Option<&'hir Expr<'hir>>),
|
||||
/// A `become`, with the value to be returned.
|
||||
Become(&'hir Expr<'hir>),
|
||||
|
||||
/// Inline assembly (from `asm!`), with its outputs and inputs.
|
||||
InlineAsm(&'hir InlineAsm<'hir>),
|
||||
|
|
|
@ -791,6 +791,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
|
|||
ExprKind::Ret(ref optional_expression) => {
|
||||
walk_list!(visitor, visit_expr, optional_expression);
|
||||
}
|
||||
ExprKind::Become(ref expr) => visitor.visit_expr(expr),
|
||||
ExprKind::InlineAsm(ref asm) => {
|
||||
visitor.visit_inline_asm(asm, expression.hir_id);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue