luaur-compiler 0.1.2

Luau source-to-bytecode compiler (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::records::cost_visitor::CostVisitor;
use luaur_ast::records::ast_expr::AstExpr;

impl CostVisitor {
    pub fn visit_ast_expr(&mut self, node: *mut AstExpr) -> bool {
        unsafe {
            if node.is_null() {
                return false;
            }

            let cost = self.model(node);
            // C++ `result += model(node)` — saturating add that zeroes the constant mask.
            self.result.add_assign(&cost);
        }

        false
    }
}