luaur-compiler 0.1.3

Luau source-to-bytecode compiler (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::functions::get_global_state::get_global_state;
use crate::records::compiler::Compiler;
use luaur_ast::records::ast_expr_global::AstExprGlobal;

impl Compiler {
    pub fn can_import(&self, expr: *mut AstExprGlobal) -> bool {
        if self.options.optimization_level < 1 {
            return false;
        }

        unsafe {
            let name = (*expr).name;
            get_global_state(&self.globals, name) != crate::enums::global::Global::Written
        }
    }
}