superui_boa_engine 0.2.2

Fork of boa_engine (boa 0.21.1) vendored for superui so the boa_parser stack-growth patch is publishable; also carries a relaxed icu_normalizer pin. See docs/fork-patches.md. Upstream: https://github.com/boa-dev/boa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::bytecompiler::ByteCompiler;
use boa_ast::statement::If;

impl ByteCompiler<'_> {
    pub(crate) fn compile_if(&mut self, node: &If, use_expr: bool) {
        let value = self.register_allocator.alloc();
        self.compile_expr(node.cond(), &value);
        let jelse = self.jump_if_false(&value);
        self.register_allocator.dealloc(value);
        self.compile_stmt(node.body(), use_expr, true);
        let exit = self.jump();
        self.patch_jump(jelse);
        if let Some(else_body) = node.else_node() {
            self.compile_stmt(else_body, use_expr, true);
        }
        self.patch_jump(exit);
    }
}