pub enum Expr {
Show 18 variants
Array(ExprArray),
Binary(ExprBinary),
Call(ExprCall),
CallOptions(ExprCallOptions),
Delete(ExprDelete),
Ident(SolIdent),
Index(ExprIndex),
Lit(Lit),
LitDenominated(LitDenominated),
Member(ExprMember),
New(ExprNew),
Payable(ExprPayable),
Postfix(ExprPostfix),
Ternary(ExprTernary),
Tuple(ExprTuple),
Type(Type),
TypeCall(ExprTypeCall),
Unary(ExprUnary),
}
Expand description
An expression.
Solidity reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.expression
Variants§
Array(ExprArray)
An array literal expression: [a, b, c, d]
.
Binary(ExprBinary)
A binary operation: a + b
, a += b
.
Call(ExprCall)
A function call expression: foo(42)
or foo({ bar: 42 })
.
CallOptions(ExprCallOptions)
Function call options: foo.bar{ value: 1, gas: 2 }
.
Delete(ExprDelete)
A unary delete
expression: delete vector
.
Ident(SolIdent)
An identifier: foo
.
Index(ExprIndex)
A square bracketed indexing expression: vector[2]
.
Lit(Lit)
A literal: hex"1234"
.
LitDenominated(LitDenominated)
A number literal with a sub-denomination: 1 ether
.
Member(ExprMember)
Access of a named member: obj.k
.
New(ExprNew)
A new
expression: new Contract
.
Payable(ExprPayable)
A payable
expression: payable(address(0x...))
.
Postfix(ExprPostfix)
A postfix unary expression: foo++
.
Ternary(ExprTernary)
A ternary (AKA conditional) expression: foo ? bar : baz
.
Tuple(ExprTuple)
A tuple expression: (a, b, c, d)
.
Type(Type)
A type name.
Cannot be Custom
, as custom identifiers are parsed as Ident
instead.
TypeCall(ExprTypeCall)
A type()
expression: type(uint256)
Unary(ExprUnary)
A unary operation: !x
, -x
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Expr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)