Skip to main content

luaur_ast/methods/
ast_expr_index_expr_ast_expr_index_expr.rs

1use crate::records::ast_expr::AstExpr;
2use crate::records::ast_expr_index_expr::AstExprIndexExpr;
3use crate::records::ast_node::AstNode;
4use crate::records::location::Location;
5use crate::rtti::AstNodeClass;
6
7impl AstExprIndexExpr {
8    pub fn new(location: Location, expr: *mut AstExpr, index: *mut AstExpr) -> Self {
9        Self {
10            base: AstExpr {
11                base: AstNode {
12                    class_index: <Self as AstNodeClass>::CLASS_INDEX,
13                    location,
14                },
15            },
16            expr,
17            index,
18        }
19    }
20}
21
22#[allow(non_snake_case)]
23pub fn ast_expr_index_expr_ast_expr_index_expr(
24    location: Location,
25    expr: *mut AstExpr,
26    index: *mut AstExpr,
27) -> AstExprIndexExpr {
28    AstExprIndexExpr::new(location, expr, index)
29}