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::enums::type_constant_folding::Type;
use crate::records::compiler::Compiler;
use crate::records::constant::Constant;
use luaur_ast::records::ast_expr::AstExpr;

impl Compiler {
    pub fn get_constant(&mut self, node: *mut AstExpr) -> Constant {
        if let Some(cv) = self.constants.find(&node) {
            *cv
        } else {
            Constant {
                r#type: Type::Type_Unknown,
                string_length: 0,
                data: unsafe { core::mem::zeroed() },
            }
        }
    }
}