pub enum Expr {
Show 13 variants
Cast {
expr: Box<Expr>,
target: DataType,
range: TextRange,
},
Call {
expr: Box<Expr>,
args: Vec<Box<Expr>>,
st_entry: Option<Rc<RefCell<FunctionEntry>>>,
locations: AllowedLocations,
input: HashSet<Data>,
result: HashSet<Data>,
metadata: HashSet<Metadata>,
range: TextRange,
},
Array {
values: Vec<Box<Expr>>,
data_type: DataType,
range: TextRange,
},
ArrayIndex {
array: Box<Expr>,
index: Box<Expr>,
data_type: DataType,
range: TextRange,
},
Pattern {
exprs: Vec<Box<Expr>>,
range: TextRange,
},
UnaOp {
op: UnaOp,
expr: Box<Expr>,
range: TextRange,
},
BinOp {
op: BinOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
range: TextRange,
},
Proj {
lhs: Box<Expr>,
rhs: Box<Expr>,
st_entry: Option<SymbolTableEntry>,
range: TextRange,
},
Instance {
name: Identifier,
properties: Vec<PropertyExpr>,
st_entry: Option<Rc<RefCell<ClassEntry>>>,
range: TextRange,
},
VarRef {
name: Identifier,
st_entry: Option<Rc<RefCell<VarEntry>>>,
},
Identifier {
name: Identifier,
st_entry: Option<Rc<RefCell<FunctionEntry>>>,
},
Literal {
literal: Literal,
},
Empty {},
}
Expand description
Defines an expression.
Variants§
Cast
Casts between two functions types.
Fields
Call
A function call.
Fields
expr: Box<Expr>
The thing that we’re calling - obviously, this must be something with a function type.
st_entry: Option<Rc<RefCell<FunctionEntry>>>
Reference to the call’s function entry.
locations: AllowedLocations
The locations where this Call is allowed to run based on the location of the datasets.
input: HashSet<Data>
If this call takes in Data or IntermediateResult, then this field will list their names. Used to only ever be the case if this call is an external call, but no more, since we’re also interested in tracking this for things like commit_result
.
Array
An array expression.
Fields
ArrayIndex
An ArrayIndex expression.
Fields
Pattern
Bakery-specific Pattern expression.
Fields
UnaOp
A unary operator.
Fields
BinOp
A binary operator.
Fields
Proj
A special case of a binary operator that implements projection.
Fields
st_entry: Option<SymbolTableEntry>
Reference to the entry that this projection points to.
Instance
An instance expression (i.e., new ...
).
Fields
name: Identifier
The identifier of the class to instantiate.
properties: Vec<PropertyExpr>
The parameters to instantiate it with, as (parameter_name, value).
st_entry: Option<Rc<RefCell<ClassEntry>>>
The reference to the class we instantiate.
VarRef
A variable reference.
Fields
name: Identifier
The identifier of the referenced variable.
Identifier
An identifier is like a variable reference but even weaker (i.e., does not expliticly link to anything - just as a placeholder for certain functions).
Fields
name: Identifier
The identifier that this expression represents.
st_entry: Option<Rc<RefCell<FunctionEntry>>>
The entry referring to the function referred. This only happens when used as identifier in a call expression.
Literal
A literal expression.
Empty
A special, compile-time only expression that may be used to mem::take
statements.
Implementations§
source§impl Expr
impl Expr
sourcepub fn new_call(
expr: Box<Expr>,
args: Vec<Box<Expr>>,
range: TextRange,
locations: AllowedLocations,
) -> Self
pub fn new_call( expr: Box<Expr>, args: Vec<Box<Expr>>, range: TextRange, locations: AllowedLocations, ) -> Self
Creates a new Call expression with some auxillary fields set to empty.
§Arguments
expr
: The expression that produces the object that we call.args
: The arguments to call it with.range
: The TextRange that relates this node to the source text.locations
: The list of locations (as an AllowedLocation) where the call may be executed.
§Returns
A new Expr::Call
instance.
sourcepub fn new_array(values: Vec<Box<Expr>>, range: TextRange) -> Self
pub fn new_array(values: Vec<Box<Expr>>, range: TextRange) -> Self
Creates a new Array expression with some auxillary fields set to empty.
§Arguments
values
: The list of values that make up this Array.range
: The TextRange that links this Array to the source text.
sourcepub fn new_array_index(
array: Box<Expr>,
index: Box<Expr>,
range: TextRange,
) -> Self
pub fn new_array_index( array: Box<Expr>, index: Box<Expr>, range: TextRange, ) -> Self
Creates a new ArrayIndex expression with some auxillary fields set to empty.
§Arguments
array
: The expression that evaluates to the Array.index
: The expression that evaluates to the Array’s index.range
: The TextRange that links this Array to the source text.
sourcepub fn new_binop(
op: BinOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
range: TextRange,
) -> Self
pub fn new_binop( op: BinOp, lhs: Box<Expr>, rhs: Box<Expr>, range: TextRange, ) -> Self
Creates a new BinOp expression with some auxillary fields set to empty.
§Arguments
op
: The binary operator that this expression operates.lhs
: The lefthand-side expression to execute the binary operation on.rhs
: The righthand-side expression to execute the binary operation on.range
: The TextRange that relates this node to the source text.
§Returns
A new Expr::BinOp
instance.
sourcepub fn new_instance(
name: Identifier,
properties: Vec<PropertyExpr>,
range: TextRange,
) -> Self
pub fn new_instance( name: Identifier, properties: Vec<PropertyExpr>, range: TextRange, ) -> Self
sourcepub fn new_varref(name: Identifier) -> Self
pub fn new_varref(name: Identifier) -> Self
sourcepub fn new_identifier(name: Identifier) -> Self
pub fn new_identifier(name: Identifier) -> Self
Trait Implementations§
source§impl EnumDebug for Expr
impl EnumDebug for Expr
source§fn type_name() -> &'static str
fn type_name() -> &'static str
source§fn variant_names() -> &'static [&'static str]
fn variant_names() -> &'static [&'static str]
source§fn variant_name(&self) -> &'static str
fn variant_name(&self) -> &'static str
source§fn variant(&self) -> EnumDebugFormatter<'_, Self>
fn variant(&self) -> EnumDebugFormatter<'_, Self>
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
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request