pub enum CSharpStmt {
Show 17 variants
Expr(CSharpExpr),
Assign {
target: CSharpExpr,
value: CSharpExpr,
},
LocalVar {
name: String,
ty: Option<CSharpType>,
init: Option<CSharpExpr>,
is_const: bool,
},
If {
cond: CSharpExpr,
then_stmts: Vec<CSharpStmt>,
else_stmts: Vec<CSharpStmt>,
},
Switch {
expr: CSharpExpr,
cases: Vec<CSharpSwitchCase>,
default: Vec<CSharpStmt>,
},
While {
cond: CSharpExpr,
body: Vec<CSharpStmt>,
},
For {
init: Option<Box<CSharpStmt>>,
cond: Option<CSharpExpr>,
step: Option<CSharpExpr>,
body: Vec<CSharpStmt>,
},
ForEach {
var_name: String,
var_ty: Option<CSharpType>,
collection: CSharpExpr,
body: Vec<CSharpStmt>,
},
Return(Option<CSharpExpr>),
Throw(CSharpExpr),
TryCatch {
try_stmts: Vec<CSharpStmt>,
catches: Vec<CSharpCatchClause>,
finally_stmts: Vec<CSharpStmt>,
},
Using {
resource: CSharpExpr,
var_name: Option<String>,
body: Vec<CSharpStmt>,
},
Lock {
obj: CSharpExpr,
body: Vec<CSharpStmt>,
},
Break,
Continue,
YieldReturn(CSharpExpr),
YieldBreak,
}Expand description
C# statement AST.
Variants§
Expr(CSharpExpr)
Expression statement: expr;
Assign
Assignment: target = value;
LocalVar
Local variable declaration: var name = expr; or Type name = expr;
If
if (cond) { ... } else { ... }
Switch
switch (expr) { case ...: ... }
While
while (cond) { ... }
For
for (init; cond; step) { ... }
Fields
§
init: Option<Box<CSharpStmt>>§
cond: Option<CSharpExpr>§
step: Option<CSharpExpr>§
body: Vec<CSharpStmt>ForEach
foreach (var item in collection) { ... }
Return(Option<CSharpExpr>)
return expr; or return;
Throw(CSharpExpr)
throw expr;
TryCatch
try { ... } catch (Type e) { ... } finally { ... }
Using
using (expr) { ... } or using var x = expr;
Lock
lock (obj) { ... }
Break
break;
Continue
continue;
YieldReturn(CSharpExpr)
yield return expr;
YieldBreak
yield break;
Trait Implementations§
Source§impl Clone for CSharpStmt
impl Clone for CSharpStmt
Source§fn clone(&self) -> CSharpStmt
fn clone(&self) -> CSharpStmt
Returns a duplicate 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 moreSource§impl Debug for CSharpStmt
impl Debug for CSharpStmt
Source§impl PartialEq for CSharpStmt
impl PartialEq for CSharpStmt
impl StructuralPartialEq for CSharpStmt
Auto Trait Implementations§
impl Freeze for CSharpStmt
impl RefUnwindSafe for CSharpStmt
impl Send for CSharpStmt
impl Sync for CSharpStmt
impl Unpin for CSharpStmt
impl UnsafeUnpin for CSharpStmt
impl UnwindSafe for CSharpStmt
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