pub enum Stmt {
Show 15 variants
Attribute(Attribute),
AttributeInner(Attribute),
Block {
block: Box<Block>,
},
Import {
name: Identifier,
version: Literal,
st_funcs: Option<Vec<Rc<RefCell<FunctionEntry>>>>,
st_classes: Option<Vec<Rc<RefCell<ClassEntry>>>>,
attrs: Vec<Attribute>,
range: TextRange,
},
FuncDef {
ident: Identifier,
params: Vec<Identifier>,
code: Box<Block>,
st_entry: Option<Rc<RefCell<FunctionEntry>>>,
attrs: Vec<Attribute>,
range: TextRange,
},
ClassDef {
ident: Identifier,
props: Vec<Property>,
methods: Vec<Box<Stmt>>,
st_entry: Option<Rc<RefCell<ClassEntry>>>,
symbol_table: Rc<RefCell<SymbolTable>>,
attrs: Vec<Attribute>,
range: TextRange,
},
Return {
expr: Option<Expr>,
data_type: DataType,
output: HashSet<Data>,
attrs: Vec<Attribute>,
range: TextRange,
},
If {
cond: Expr,
consequent: Box<Block>,
alternative: Option<Box<Block>>,
attrs: Vec<Attribute>,
range: TextRange,
},
For {
initializer: Box<Stmt>,
condition: Expr,
increment: Box<Stmt>,
consequent: Box<Block>,
attrs: Vec<Attribute>,
range: TextRange,
},
While {
condition: Expr,
consequent: Box<Block>,
attrs: Vec<Attribute>,
range: TextRange,
},
Parallel {
result: Option<Identifier>,
blocks: Vec<Block>,
merge: Option<Identifier>,
st_entry: Option<Rc<RefCell<VarEntry>>>,
attrs: Vec<Attribute>,
range: TextRange,
},
LetAssign {
name: Identifier,
value: Expr,
st_entry: Option<Rc<RefCell<VarEntry>>>,
attrs: Vec<Attribute>,
range: TextRange,
},
Assign {
name: Identifier,
value: Expr,
st_entry: Option<Rc<RefCell<VarEntry>>>,
attrs: Vec<Attribute>,
range: TextRange,
},
Expr {
expr: Expr,
data_type: DataType,
attrs: Vec<Attribute>,
range: TextRange,
},
Empty {},
}Expand description
Defines a single statement.
Variants§
Attribute(Attribute)
Defines an unprocessed #[...] attirbute.
AttributeInner(Attribute)
Defines an unprocessed #![...] attriute.
Block
Defines a block statement (i.e., { ... }).
Import
Defines a package import.
Fields
name: IdentifierThe name of the package that we import.
st_funcs: Option<Vec<Rc<RefCell<FunctionEntry>>>>Reference to the function symbol table entries that this import generates.
FuncDef
Defines a function definition.
Fields
ident: IdentifierThe name of the function, as an identifier.
params: Vec<Identifier>The parameters of the function, as identifiers.
st_entry: Option<Rc<RefCell<FunctionEntry>>>Reference to the symbol table entry this function generates.
ClassDef
Defines a class definition.
Fields
ident: IdentifierThe name of the class, as an identifier.
st_entry: Option<Rc<RefCell<ClassEntry>>>Reference to the symbol table entry this class generates.
symbol_table: Rc<RefCell<SymbolTable>>The SymbolTable that hosts the nested declarations. Is also found in the ClassEntry itself to resolve children.
Return
Defines a return statement.
Fields
If
Defines an if-statement.
Fields
For
Defines a for-loop.
Fields
While
Defines a while-loop.
Fields
Parallel
Defines a parallel block (i.e., multiple branches run in parallel).
Fields
result: Option<Identifier>The (optional) identifier to which to write the result of the parallel statement.
blocks: Vec<Block>The code blocks to run in parallel. This may either be a Block or an On-statement.
merge: Option<Identifier>The merge-strategy used in the parallel statement.
LetAssign
Defines a variable definition (i.e., let <name> := <expr>).
Fields
name: IdentifierThe name of the variable referenced.
Assign
Defines an assignment (i.e., <name> := <expr>).
Fields
name: IdentifierThe name of the variable referenced.
Expr
Defines a loose expression.
Fields
Empty
A special, compile-time only statement that may be used to mem::take statements.
Implementations§
Source§impl Stmt
impl Stmt
Sourcepub fn new_import(name: Identifier, version: Literal, range: TextRange) -> Self
pub fn new_import(name: Identifier, version: Literal, range: TextRange) -> Self
Creates a new Import node with some auxillary fields set to empty.
§Arguments
name: The name of the package to import (as an identifier).version: The literal with the package version (i.e., should ‘Literal::Semver’). ‘latest’ should be assumed if the user did not specify it.range: The TextRange that relates this node to the source text.
§Returns
A new Stmt::Import instance.
Sourcepub fn new_funcdef(
ident: Identifier,
params: Vec<Identifier>,
code: Box<Block>,
range: TextRange,
) -> Self
pub fn new_funcdef( ident: Identifier, params: Vec<Identifier>, code: Box<Block>, range: TextRange, ) -> Self
Creates a new FuncDef node with some auxillary fields set to empty.
§Arguments
ident: The name of the function, as an identifier.params: The parameters of the function, as identifiers.code: The code to execute when running this function.range: The TextRange that relates this node to the source text.
§Returns
A new Stmt::FuncDef instance.
Sourcepub fn new_classdef(
ident: Identifier,
props: Vec<Property>,
methods: Vec<Box<Stmt>>,
range: TextRange,
) -> Self
pub fn new_classdef( ident: Identifier, props: Vec<Property>, methods: Vec<Box<Stmt>>, range: TextRange, ) -> Self
Creates a new ClassDef node with some auxillary fields set to empty.
§Arguments
ident: The name of the class, as an identifier.props: The properties of the class, as (identifier, type) pairs.methods: The methods belonging to this class, as a vector of function definitions.range: The TextRange that relates this node to the source text.
§Returns
A new Stmt::ClassDef instance.
Sourcepub fn new_return(expr: Option<Expr>, range: TextRange) -> Self
pub fn new_return(expr: Option<Expr>, range: TextRange) -> Self
Sourcepub fn new_parallel(
result: Option<Identifier>,
blocks: Vec<Block>,
merge: Option<Identifier>,
range: TextRange,
) -> Self
pub fn new_parallel( result: Option<Identifier>, blocks: Vec<Block>, merge: Option<Identifier>, range: TextRange, ) -> Self
Creates a new Parallel node with some auxillary fields set to empty.
§Arguments
result: An optional identifier to which this Parallel may write its result.blocks: The codeblocks to run in parallel.merge: The merge strategy to use for this Parallel statement.range: The TextRange that relates this node to the source text.
§Returns
A new Stmt::Parallel instance.
Sourcepub fn new_letassign(name: Identifier, value: Expr, range: TextRange) -> Self
pub fn new_letassign(name: Identifier, value: Expr, range: TextRange) -> Self
Sourcepub fn new_assign(name: Identifier, value: Expr, range: TextRange) -> Self
pub fn new_assign(name: Identifier, value: Expr, range: TextRange) -> Self
Trait Implementations§
Source§impl EnumDebug for Stmt
impl EnumDebug for Stmt
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 Stmt
impl !RefUnwindSafe for Stmt
impl !Send for Stmt
impl !Sync for Stmt
impl Unpin for Stmt
impl !UnwindSafe for Stmt
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§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