Skip to main content

luaur_ast/methods/
ast_expr_function_has_native_attribute.rs

1use crate::records::ast_attr::AstAttr;
2use crate::records::ast_expr_function::AstExprFunction;
3
4impl AstExprFunction {
5    pub fn has_native_attribute(&self) -> bool {
6        for i in 0..self.attributes.size {
7            let attribute_ptr = unsafe { *self.attributes.data.add(i) };
8            if !attribute_ptr.is_null() {
9                let attribute = unsafe { &*attribute_ptr };
10                if attribute.r#type == crate::records::ast_attr::AstAttrType::Native {
11                    return true;
12                }
13            }
14        }
15        false
16    }
17}
18
19#[allow(non_snake_case)]
20pub fn ast_expr_function_has_native_attribute(this: &AstExprFunction) -> bool {
21    this.has_native_attribute()
22}