luaur-analysis 0.1.1

Luau type checker and type inference (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::records::expr_or_local::ExprOrLocal;
use luaur_ast::records::location::Location;

impl ExprOrLocal {
    pub fn get_location(&self) -> Option<Location> {
        let expr = self.get_expr();
        if !expr.is_null() {
            return Some(unsafe { (*expr).base.location });
        }

        let local = self.get_local();
        if !local.is_null() {
            return Some(unsafe { (*local).location });
        }

        None
    }
}