enum Nesting {
    Loop,
    Switch {
        variable: Rc<String>,
        continue_encountered: bool,
    },
}Expand description
A summary of the code surrounding a statement.
Variants§
Loop
Currently nested in at least one Loop statement.
Continue should apply to the innermost loop.
When this entry is on the top of the stack:
- 
When entering an inner
Loopstatement, push aLoopstate onto the stack. - 
When entering a nested
Switchstatement, push aSwitchstate onto the stack with a new variable name. Before the generatedswitch, introduce aboollocal with that name, initialized tofalse. 
When exiting the Loop for which this entry was pushed, pop it from
the stack.
Switch
Currently nested in at least one Switch that may need to forward
Continues.
This includes Switches rendered as do {} while(false) loops, but
doesn’t need to include regular Switches in backends that can
support continue within switches.
Continue should be forwarded to the innermost surrounding Loop.
When this entry is on the top of the stack:
- 
When entering a nested
Loop, push aLoopstate onto the stack. - 
When entering a nested
Switch, push aSwitchstate onto the stack with a clone of the introducedboolvariable’s name. - 
When encountering a
Continuestatement, render it as code to set the introducedboollocal (whose name is held invariable) totrue, and thenbreak. Setcontinue_encounteredtotrueto record that theSwitchcontains aContinue. - 
When exiting this
Switch, pop its entry from the stack. Ifcontinue_encounteredis set, then we have renderedContinuestatements asbreakstatements that jump to this point. Generate code to checkvariable, and if it istrue: 
When we exit the Switch for which this entry was pushed, pop it.
Fields
continue_encountered: boolSet if we’ve generated code for a Continue statement with this
entry on the top of the stack.
If this is still clear when we finish rendering the Switch, then
we know we don’t need to generate branch forwarding code. Omitting
that may make it easier for drivers to tell that the bool we
introduced ahead of the Switch is actually unused.