Skip to main content

luaur_analysis/functions/
is_function.rs

1use luaur_ast::records::ast_stat::AstStat;
2use luaur_ast::records::ast_stat_function::AstStatFunction;
3use luaur_ast::records::ast_stat_local_function::AstStatLocalFunction;
4use luaur_ast::rtti::ast_node_is;
5
6pub fn is_function(stat: &AstStat) -> bool {
7    let node = stat as *const AstStat as *mut luaur_ast::records::ast_node::AstNode;
8    unsafe { ast_node_is::<AstStatFunction>(node) || ast_node_is::<AstStatLocalFunction>(node) }
9}