Skip to main content

luaur_ast/methods/
ast_stat_local_function_ast_stat_local_function.rs

1use crate::records::ast_expr_function::AstExprFunction;
2use crate::records::ast_local::AstLocal;
3use crate::records::ast_node::AstNode;
4use crate::records::ast_stat::AstStat;
5use crate::records::ast_stat_local_function::AstStatLocalFunction;
6use crate::records::location::Location;
7use crate::rtti::AstNodeClass;
8
9impl AstStatLocalFunction {
10    pub fn new(
11        location: Location,
12        name: *mut AstLocal,
13        func: *mut AstExprFunction,
14        is_const: bool,
15    ) -> Self {
16        Self {
17            base: AstStat {
18                base: AstNode {
19                    class_index: <Self as AstNodeClass>::CLASS_INDEX,
20                    location,
21                },
22                has_semicolon: false,
23            },
24            name,
25            func,
26            is_const,
27        }
28    }
29}
30
31#[allow(non_snake_case)]
32pub fn ast_stat_local_function_ast_stat_local_function(
33    location: Location,
34    name: *mut AstLocal,
35    func: *mut AstExprFunction,
36    is_const: bool,
37) -> AstStatLocalFunction {
38    AstStatLocalFunction::new(location, name, func, is_const)
39}