//! This module describes hir-level representation of expressions. //! //! This representation is: //! //! 1. Identity-based. Each expression has an `id`, so we can distinguish //! between different `1` in `1 + 1`. //! 2. Independent of syntax. Though syntactic provenance information can be //! attached separately via id-based side map. //! 3. Unresolved. Paths are stored as sequences of names, and not as defs the //! names refer to. //! 4. Desugared. There's no `if let`. //! //! See also a neighboring `body` module. use std::fmt; use hir_expand::name::Name; use intern::Interned; use la_arena::{Idx, RawIdx}; use crate::{ builtin_type::{BuiltinFloat, BuiltinInt, BuiltinUint}, path::{GenericArgs, Path}, type_ref::{Mutability, Rawness, TypeRef}, BlockId, }; pub use syntax::ast::{ArithOp, BinaryOp, CmpOp, LogicOp, Ordering, RangeOp, UnaryOp}; pub type ExprId = Idx; /// FIXME: this is a hacky function which should be removed pub(crate) fn dummy_expr_id() -> ExprId { ExprId::from_raw(RawIdx::from(u32::MAX)) } pub type PatId = Idx; #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum ExprOrPatId { ExprId(ExprId), PatId(PatId), } stdx::impl_from!(ExprId, PatId for ExprOrPatId); #[derive(Debug, Clone, Eq, PartialEq)] pub struct Label { pub name: Name, } pub type LabelId = Idx