boa/syntax/ast/node/iteration/
mod.rs

1//! Iteration nodes
2
3pub use self::{
4    continue_node::Continue, do_while_loop::DoWhileLoop, for_in_loop::ForInLoop, for_loop::ForLoop,
5    for_of_loop::ForOfLoop, while_loop::WhileLoop,
6};
7
8#[cfg(test)]
9mod tests;
10
11// Checking labels for break and continue is the same operation for `ForLoop`, `While` and `DoWhile`
12macro_rules! handle_state_with_labels {
13    ($self:ident, $label:ident, $interpreter:ident, $state:tt) => {{
14        if let Some(brk_label) = $label {
15            if let Some(stmt_label) = $self.label() {
16                // Break from where we are, keeping "continue" set as the state
17                if stmt_label != brk_label.as_ref() {
18                    break;
19                }
20            } else {
21                // if a label is set but the current block has no label, break
22                break;
23            }
24        }
25
26        $interpreter
27            .executor()
28            .set_current_state(InterpreterState::Executing);
29    }};
30}
31
32pub mod continue_node;
33pub mod do_while_loop;
34pub mod for_in_loop;
35pub mod for_loop;
36pub mod for_of_loop;
37pub mod while_loop;