Skip to main content

luaur_ast/methods/
ast_expr_table_ast_expr_table.rs

1use crate::records::ast_array::AstArray;
2use crate::records::ast_expr::AstExpr;
3use crate::records::ast_expr_table::{AstExprTable, Item};
4use crate::records::ast_node::AstNode;
5use crate::records::location::Location;
6use crate::rtti::AstNodeClass;
7
8impl AstExprTable {
9    pub fn new(location: Location, items: AstArray<Item>) -> Self {
10        Self {
11            base: AstExpr {
12                base: AstNode {
13                    class_index: <Self as AstNodeClass>::CLASS_INDEX,
14                    location,
15                },
16            },
17            items,
18        }
19    }
20}
21
22#[no_mangle]
23pub extern "C" fn ast_expr_table_ast_expr_table(
24    location: Location,
25    items: AstArray<Item>,
26) -> AstExprTable {
27    AstExprTable::new(location, items)
28}