Enum sway_core::language::ty::TyExpressionVariant
source · pub enum TyExpressionVariant {
Show 28 variants
Literal(Literal),
FunctionApplication {
call_path: CallPath,
contract_call_params: HashMap<String, TyExpression>,
arguments: Vec<(Ident, TyExpression)>,
fn_ref: DeclRefFunction,
selector: Option<ContractCallParams>,
type_binding: Option<TypeBinding<()>>,
call_path_typeid: Option<TypeId>,
},
LazyOperator {
op: LazyOp,
lhs: Box<TyExpression>,
rhs: Box<TyExpression>,
},
ConstantExpression {
span: Span,
const_decl: Box<TyConstantDecl>,
call_path: Option<CallPath>,
},
VariableExpression {
name: Ident,
span: Span,
mutability: VariableMutability,
call_path: Option<CallPath>,
},
Tuple {
fields: Vec<TyExpression>,
},
Array {
elem_type: TypeId,
contents: Vec<TyExpression>,
},
ArrayIndex {
prefix: Box<TyExpression>,
index: Box<TyExpression>,
},
StructExpression {
struct_ref: DeclRef<DeclId<TyStructDecl>>,
fields: Vec<TyStructExpressionField>,
instantiation_span: Span,
call_path_binding: TypeBinding<CallPath>,
},
CodeBlock(TyCodeBlock),
FunctionParameter,
MatchExp {
desugared: Box<TyExpression>,
scrutinees: Vec<TyScrutinee>,
},
IfExp {
condition: Box<TyExpression>,
then: Box<TyExpression>,
else: Option<Box<TyExpression>>,
},
AsmExpression {
registers: Vec<TyAsmRegisterDeclaration>,
body: Vec<AsmOp>,
returns: Option<(AsmRegister, Span)>,
whole_block_span: Span,
},
StructFieldAccess {
prefix: Box<TyExpression>,
field_to_access: TyStructField,
field_instantiation_span: Span,
resolved_type_of_parent: TypeId,
},
TupleElemAccess {
prefix: Box<TyExpression>,
elem_to_access_num: usize,
resolved_type_of_parent: TypeId,
elem_to_access_span: Span,
},
EnumInstantiation {
enum_ref: DeclRef<DeclId<TyEnumDecl>>,
variant_name: Ident,
tag: usize,
contents: Option<Box<TyExpression>>,
variant_instantiation_span: Span,
call_path_binding: TypeBinding<CallPath>,
call_path_decl: TyDecl,
},
AbiCast {
abi_name: CallPath,
address: Box<TyExpression>,
span: Span,
},
StorageAccess(TyStorageAccess),
IntrinsicFunction(TyIntrinsicFunctionKind),
AbiName(AbiName),
EnumTag {
exp: Box<TyExpression>,
},
UnsafeDowncast {
exp: Box<TyExpression>,
variant: TyEnumVariant,
call_path_decl: TyDecl,
},
WhileLoop {
condition: Box<TyExpression>,
body: TyCodeBlock,
},
Break,
Continue,
Reassignment(Box<TyReassignment>),
Return(Box<TyExpression>),
}
Variants§
Literal(Literal)
FunctionApplication
Fields
§
contract_call_params: HashMap<String, TyExpression>
§
arguments: Vec<(Ident, TyExpression)>
§
fn_ref: DeclRefFunction
§
selector: Option<ContractCallParams>
LazyOperator
ConstantExpression
VariableExpression
Tuple
Fields
§
fields: Vec<TyExpression>
Array
ArrayIndex
StructExpression
CodeBlock(TyCodeBlock)
FunctionParameter
MatchExp
IfExp
AsmExpression
StructFieldAccess
TupleElemAccess
Fields
§
prefix: Box<TyExpression>
EnumInstantiation
Fields
§
enum_ref: DeclRef<DeclId<TyEnumDecl>>
§
contents: Option<Box<TyExpression>>
AbiCast
StorageAccess(TyStorageAccess)
IntrinsicFunction(TyIntrinsicFunctionKind)
AbiName(AbiName)
a zero-sized type-system-only compile-time thing that is used for constructing ABI casts.
EnumTag
Fields
§
exp: Box<TyExpression>
grabs the enum tag from the particular enum and variant of the exp
UnsafeDowncast
performs an unsafe cast from the exp
to the type of the given enum variant
WhileLoop
Break
Continue
Reassignment(Box<TyReassignment>)
Return(Box<TyExpression>)
Trait Implementations§
source§impl Clone for TyExpressionVariant
impl Clone for TyExpressionVariant
source§fn clone(&self) -> TyExpressionVariant
fn clone(&self) -> TyExpressionVariant
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for TyExpressionVariant
impl Send for TyExpressionVariant
impl Sync for TyExpressionVariant
impl Unpin for TyExpressionVariant
impl UnwindSafe for TyExpressionVariant
Blanket Implementations§
source§impl<T> AnyDebug for Twhere
T: Any + Debug,
impl<T> AnyDebug for Twhere T: Any + Debug,
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Returns a reference to the underlying type as
Any
.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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.