]> git.lizzy.rs Git - rust.git/blobdiff - crates/hir_def/src/expr.rs
Use ‘index’ terminology for arena consistently
[rust.git] / crates / hir_def / src / expr.rs
index 6a481769dbc50ed191824500c6860dae3ecae621..5be838f4a7d842ae7fb45011eebadae56e5ea011 100644 (file)
@@ -1,6 +1,6 @@
 //! This module describes hir-level representation of expressions.
 //!
-//! This representaion is:
+//! This representation is:
 //!
 //! 1. Identity-based. Each expression has an `id`, so we can distinguish
 //!    between different `1` in `1 + 1`.
@@ -12,8 +12,8 @@
 //!
 //! See also a neighboring `body` module.
 
-use arena::{Idx, RawId};
 use hir_expand::name::Name;
+use la_arena::{Idx, RawIdx};
 use syntax::ast::RangeOp;
 
 use crate::{
@@ -24,7 +24,7 @@
 
 pub type ExprId = Idx<Expr>;
 pub(crate) fn dummy_expr_id() -> ExprId {
-    ExprId::from_raw(RawId::from(!0))
+    ExprId::from_raw(RawIdx::from(!0))
 }
 
 pub type PatId = Idx<Pat>;
@@ -99,6 +99,9 @@ pub enum Expr {
     Return {
         expr: Option<ExprId>,
     },
+    Yield {
+        expr: Option<ExprId>,
+    },
     RecordLit {
         path: Option<Path>,
         fields: Vec<RecordLitField>,
@@ -294,7 +297,7 @@ pub fn walk_child_exprs(&self, mut f: impl FnMut(ExprId)) {
                 }
             }
             Expr::Continue { .. } => {}
-            Expr::Break { expr, .. } | Expr::Return { expr } => {
+            Expr::Break { expr, .. } | Expr::Return { expr } | Expr::Yield { expr } => {
                 if let Some(expr) = expr {
                     f(*expr);
                 }