luaur_analysis/functions/
is_record.rs1use luaur_ast::records::ast_expr_constant_string::AstExprConstantString;
2use luaur_ast::records::ast_expr_table::Item;
3use luaur_ast::records::ast_expr_table::ItemKind;
4
5pub fn is_record(item: &Item) -> bool {
6 if item.kind == ItemKind::Record {
7 return true;
8 } else if item.kind == ItemKind::General {
9 if item.key.is_null() {
10 return false;
11 }
12
13 if luaur_ast::rtti::ast_node_is::<AstExprConstantString>(unsafe {
14 &*(item.key as *mut luaur_ast::records::ast_node::AstNode)
15 }) {
16 return true;
17 }
18
19 false
20 } else {
21 false
22 }
23}