luaur_analysis/methods/expr_or_local_get_location.rs
1use crate::records::expr_or_local::ExprOrLocal;
2use luaur_ast::records::location::Location;
3
4impl ExprOrLocal {
5 pub fn get_location(&self) -> Option<Location> {
6 let expr = self.get_expr();
7 if !expr.is_null() {
8 return Some(unsafe { (*expr).base.location });
9 }
10
11 let local = self.get_local();
12 if !local.is_null() {
13 return Some(unsafe { (*local).location });
14 }
15
16 None
17 }
18}