Struct valkyrie_ast::WhileLoop
source · pub struct WhileLoop {
pub kind: WhileLoopKind,
pub condition: WhileConditionNode,
pub then: StatementBlock,
pub span: Range<u32>,
}Expand description
while cond {...} otherwise {...}
outer: loop {
if c1 {
break; // break 'outer
}
if c2 {
continue; // continue 'outer
}
if c3 {
return;
}
inner: loop {
if c4 {
break 'outer;
}
if c5 {
continue 'outer;
}
if c6 {
return;
}
if c7 {
break; // break 'inner
}
if c8 {
continue; // continue 'inner
}
if c9 {
return;
}
"inner-continuation"
}
"outer-continuation"
}
"function-continuation"
// promotion local variable here!!
let outer_continue = || {
if c1 {
outer_break()
}
if c2 {
outer_continue();
}
if c3 {
return;
}
inner: loop {
if c4 {
outer_break()
}
if c5 {
outer_continue()
}
if c6 {
return;
}
if c7 {
break; // break 'inner
}
if c8 {
continue; // continue 'inner
}
if c9 {
return;
}
"inner-continuation"
}
"outer-continuation"
}
let outer_break = || {
"function-continuation"
}
// promotion local variable here!!
let outer_continue = || {
if c1 {
outer_break()
}
if c2 {
outer_continue();
}
if c3 {
return;
}
inner_continue()
}
let outer_break = || {
"function-continuation"
}
let inner_continue = || {
if c4 {
outer_break()
}
if c5 {
outer_continue()
}
if c6 {
return;
}
if c7 {
inner_break()
}
if c8 {
inner_continue()
}
if c9 {
return;
}
}
let inner_break = || {
"outer-continuation"
}
Fields§
§kind: WhileLoopKindThe kind of while loop, including while and until
condition: WhileConditionNodeThe condition of the loop
then: StatementBlockThe main body of the loop
span: Range<u32>The range of the node
Trait Implementations§
source§impl From<WhileLoop> for StatementKind
impl From<WhileLoop> for StatementKind
source§impl PartialEq for WhileLoop
impl PartialEq for WhileLoop
source§impl ValkyrieNode for WhileLoop
impl ValkyrieNode for WhileLoop
impl Eq for WhileLoop
impl StructuralPartialEq for WhileLoop
Auto Trait Implementations§
impl RefUnwindSafe for WhileLoop
impl Send for WhileLoop
impl Sync for WhileLoop
impl Unpin for WhileLoop
impl UnwindSafe for WhileLoop
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