Skip to main content

luaur_compiler/methods/
compiler_can_import.rs

1use crate::functions::get_global_state::get_global_state;
2use crate::records::compiler::Compiler;
3use luaur_ast::records::ast_expr_global::AstExprGlobal;
4
5impl Compiler {
6    pub fn can_import(&self, expr: *mut AstExprGlobal) -> bool {
7        if self.options.optimization_level < 1 {
8            return false;
9        }
10
11        unsafe {
12            let name = (*expr).name;
13            get_global_state(&self.globals, name) != crate::enums::global::Global::Written
14        }
15    }
16}