boa_engine 0.17.0

Boa is a Javascript lexer, parser and compiler written in Rust. Currently, it has support for some of the language.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{bytecompiler::ByteCompiler, vm::Opcode};
use boa_ast::statement::With;

impl ByteCompiler<'_, '_> {
    /// Compile a [`With`] `boa_ast` node
    pub(crate) fn compile_with(&mut self, with: &With, use_expr: bool) {
        self.compile_expr(with.expression(), true);
        self.push_compile_environment(false);
        self.emit_opcode(Opcode::PushObjectEnvironment);

        self.compile_stmt(with.statement(), use_expr, true);

        self.pop_compile_environment();
        self.emit_opcode(Opcode::PopEnvironment);
    }
}