Enum erg_compiler::hir::Expr
source · pub enum Expr {
Show 20 variants
Literal(Literal),
Accessor(Accessor),
Array(Array),
Tuple(Tuple),
Set(Set),
Dict(Dict),
Record(Record),
BinOp(BinOp),
UnaryOp(UnaryOp),
Call(Call),
Lambda(Lambda),
Def(Def),
ClassDef(ClassDef),
PatchDef(PatchDef),
ReDef(ReDef),
TypeAsc(TypeAscription),
Code(Block),
Compound(Block),
Import(Accessor),
Dummy(Dummy),
}
Variants§
Literal(Literal)
Accessor(Accessor)
Array(Array)
Tuple(Tuple)
Set(Set)
Dict(Dict)
Record(Record)
BinOp(BinOp)
UnaryOp(UnaryOp)
Call(Call)
Lambda(Lambda)
Def(Def)
ClassDef(ClassDef)
PatchDef(PatchDef)
ReDef(ReDef)
TypeAsc(TypeAscription)
Code(Block)
Compound(Block)
Import(Accessor)
Dummy(Dummy)
Implementations§
source§impl Expr
impl Expr
pub fn receiver_t(&self) -> Option<&Type>
pub fn show_acc(&self) -> Option<String>
pub fn var_info(&self) -> Option<&VarInfo>
sourcepub fn qual_name(&self) -> Option<Str>
pub fn qual_name(&self) -> Option<Str>
参照するオブジェクト自体が持っている名前(e.g. Int.qual_name == Some(“int”), Socket!.qual_name == Some(“io.Socket!”))
sourcepub fn local_name(&self) -> Option<&str>
pub fn local_name(&self) -> Option<&str>
e.g. Int.local_name == Some(“int”), Socket!.local_name == Some(“Socket!”)
pub fn is_py_api(&self) -> bool
pub fn is_acc(&self) -> bool
pub fn last_name(&self) -> Option<&VarName>
pub fn is_type_asc(&self) -> bool
pub fn is_doc_comment(&self) -> bool
pub const fn name(&self) -> &'static str
pub fn need_to_be_closed(&self) -> bool
pub fn call(self, args: Args) -> Call
pub fn call_expr(self, args: Args) -> Self
pub fn call1(self, expr: Expr) -> Self
pub fn call2(self, expr1: Expr, expr2: Expr) -> Self
pub fn attr(self, ident: Identifier) -> Accessor
pub fn attr_expr(self, ident: Identifier) -> Self
pub fn type_asc(self, t_spec: TypeSpecWithOp) -> TypeAscription
pub fn type_asc_expr(self, t_spec: TypeSpecWithOp) -> Self
sourcepub fn complexity(&self) -> usize
pub fn complexity(&self) -> usize
Return the complexity of the expression in terms of type inference. For function calls, type inference is performed sequentially, starting with the least complex argument.
pub fn try_from_type(typ: Type) -> Result<Expr, Type>
Trait Implementations§
source§impl From<Identifier> for Expr
impl From<Identifier> for Expr
source§fn from(ident: Identifier) -> Self
fn from(ident: Identifier) -> Self
Converts to this type from the input type.
source§impl FromIterator<Expr> for Block
impl FromIterator<Expr> for Block
source§impl FromIterator<Expr> for Dummy
impl FromIterator<Expr> for Dummy
source§impl FromIterator<Expr> for Module
impl FromIterator<Expr> for Module
source§impl HasType for Expr
impl HasType for Expr
fn ref_t(&self) -> &Type
fn ref_mut_t(&mut self) -> Option<&mut Type>
fn signature_t(&self) -> Option<&Type>
fn signature_mut_t(&mut self) -> Option<&mut Type>
fn t(&self) -> Type
fn inner_ts(&self) -> Vec<Type>
fn lhs_t(&self) -> &Type
fn rhs_t(&self) -> &Type
source§impl Locational for Expr
impl Locational for Expr
source§impl NestedDisplay for Expr
impl NestedDisplay for Expr
source§impl NoTypeDisplay for Expr
impl NoTypeDisplay for Expr
fn to_string_notype(&self) -> String
source§impl PartialEq for Expr
impl PartialEq for Expr
source§impl Stream<Expr> for Block
impl Stream<Expr> for Block
fn payload(self) -> Vec<Expr>
fn ref_payload(&self) -> &Vec<Expr>
fn ref_mut_payload(&mut self) -> &mut Vec<Expr>
fn clear(&mut self)
fn len(&self) -> usize
fn size(&self) -> usize
fn is_empty(&self) -> bool
fn insert(&mut self, idx: usize, elem: T)
fn remove(&mut self, idx: usize) -> T
fn push(&mut self, elem: T)
fn append<S>(&mut self, s: &mut S)where
S: Stream<T>,
fn pop(&mut self) -> Option<T>
fn lpop(&mut self) -> Option<T>
fn get(&self, idx: usize) -> Option<&T>
fn get_mut(&mut self, idx: usize) -> Option<&mut T>
fn first(&self) -> Option<&T>
fn first_mut(&mut self) -> Option<&mut T>
fn last(&self) -> Option<&T>
fn last_mut(&mut self) -> Option<&mut T>
fn iter(&self) -> Iter<'_, T>
fn iter_mut(&mut self) -> IterMut<'_, T>
fn take_all(&mut self) -> Vec<T>
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
fn split_off(&mut self, at: usize) -> Vec<T>
source§fn retain(&mut self, f: impl FnMut(&T) -> bool)
fn retain(&mut self, f: impl FnMut(&T) -> bool)
Remove all elements that don’t satisfy the predicate.
fn concat(self, other: Self) -> Self
source§impl Stream<Expr> for Dummy
impl Stream<Expr> for Dummy
fn payload(self) -> Vec<Expr>
fn ref_payload(&self) -> &Vec<Expr>
fn ref_mut_payload(&mut self) -> &mut Vec<Expr>
fn clear(&mut self)
fn len(&self) -> usize
fn size(&self) -> usize
fn is_empty(&self) -> bool
fn insert(&mut self, idx: usize, elem: T)
fn remove(&mut self, idx: usize) -> T
fn push(&mut self, elem: T)
fn append<S>(&mut self, s: &mut S)where
S: Stream<T>,
fn pop(&mut self) -> Option<T>
fn lpop(&mut self) -> Option<T>
fn get(&self, idx: usize) -> Option<&T>
fn get_mut(&mut self, idx: usize) -> Option<&mut T>
fn first(&self) -> Option<&T>
fn first_mut(&mut self) -> Option<&mut T>
fn last(&self) -> Option<&T>
fn last_mut(&mut self) -> Option<&mut T>
fn iter(&self) -> Iter<'_, T>
fn iter_mut(&mut self) -> IterMut<'_, T>
fn take_all(&mut self) -> Vec<T>
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
fn split_off(&mut self, at: usize) -> Vec<T>
source§fn retain(&mut self, f: impl FnMut(&T) -> bool)
fn retain(&mut self, f: impl FnMut(&T) -> bool)
Remove all elements that don’t satisfy the predicate.
fn concat(self, other: Self) -> Self
source§impl Stream<Expr> for Module
impl Stream<Expr> for Module
fn payload(self) -> Vec<Expr>
fn ref_payload(&self) -> &Vec<Expr>
fn ref_mut_payload(&mut self) -> &mut Vec<Expr>
fn clear(&mut self)
fn len(&self) -> usize
fn size(&self) -> usize
fn is_empty(&self) -> bool
fn insert(&mut self, idx: usize, elem: T)
fn remove(&mut self, idx: usize) -> T
fn push(&mut self, elem: T)
fn append<S>(&mut self, s: &mut S)where
S: Stream<T>,
fn pop(&mut self) -> Option<T>
fn lpop(&mut self) -> Option<T>
fn get(&self, idx: usize) -> Option<&T>
fn get_mut(&mut self, idx: usize) -> Option<&mut T>
fn first(&self) -> Option<&T>
fn first_mut(&mut self) -> Option<&mut T>
fn last(&self) -> Option<&T>
fn last_mut(&mut self) -> Option<&mut T>
fn iter(&self) -> Iter<'_, T>
fn iter_mut(&mut self) -> IterMut<'_, T>
fn take_all(&mut self) -> Vec<T>
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
fn split_off(&mut self, at: usize) -> Vec<T>
source§fn retain(&mut self, f: impl FnMut(&T) -> bool)
fn retain(&mut self, f: impl FnMut(&T) -> bool)
Remove all elements that don’t satisfy the predicate.
fn concat(self, other: Self) -> Self
impl Eq for Expr
impl StructuralEq for Expr
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more