luaur_compiler/methods/
compiler_can_import_chain.rs1use crate::functions::get_global_state::get_global_state;
2use crate::records::compiler::Compiler;
3use luaur_ast::records::ast_expr_global::AstExprGlobal;
4use luaur_ast::records::ast_name::AstName;
5
6use crate::enums::global::Global;
7
8impl Compiler {
9 pub fn can_import_chain(&self, expr: *mut AstExprGlobal) -> bool {
10 if self.options.optimization_level < 1 {
11 return false;
12 }
13 if expr.is_null() {
14 return false;
15 }
16
17 unsafe {
18 let name: AstName = (*expr).name;
19 get_global_state(&self.globals, name) == Global::Default
20 }
21 }
22}