luaur_compiler/methods/compiler_get_expr_local_reg.rs
1use crate::records::compiler::Compiler;
2use luaur_ast::records::ast_expr::AstExpr;
3
4impl Compiler {
5 pub fn get_expr_local_reg(&mut self, node: *mut AstExpr) -> i32 {
6 unsafe {
7 let expr = self.get_expr_local(node);
8 if expr.is_null() {
9 return -1;
10 }
11
12 match self.locals.find(&(*expr).local) {
13 Some(l) if l.allocated => l.reg as i32,
14 _ => -1,
15 }
16 }
17 }
18}