Boa 0.9.0

Boa is a Javascript lexer, parser and Just-in-Time 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
17
18
use super::{Executable, Interpreter};
use crate::{
    builtins::{ResultValue, Value},
    syntax::ast::node::If,
};
use std::borrow::Borrow;

impl Executable for If {
    fn run(&self, interpreter: &mut Interpreter) -> ResultValue {
        Ok(if self.cond().run(interpreter)?.borrow().is_true() {
            self.body().run(interpreter)?
        } else if let Some(ref else_e) = self.else_node() {
            else_e.run(interpreter)?
        } else {
            Value::undefined()
        })
    }
}