Skip to main content

luaur_ast/methods/
ast_expr_binary_ast_expr_binary.rs

1use crate::records::ast_expr::AstExpr;
2use crate::records::ast_expr_binary::{AstExprBinary, AstExprBinary_Op};
3use crate::records::ast_node::AstNode;
4use crate::records::location::Location;
5use crate::rtti::AstNodeClass;
6
7impl AstExprBinary {
8    pub fn new(
9        location: Location,
10        op: AstExprBinary_Op,
11        left: *mut AstExpr,
12        right: *mut AstExpr,
13    ) -> Self {
14        Self {
15            base: AstExpr {
16                base: AstNode {
17                    class_index: <Self as AstNodeClass>::CLASS_INDEX,
18                    location,
19                },
20            },
21            op,
22            left,
23            right,
24        }
25    }
26}
27
28#[allow(non_snake_case)]
29pub fn ast_expr_binary_ast_expr_binary(
30    location: Location,
31    op: AstExprBinary_Op,
32    left: *mut AstExpr,
33    right: *mut AstExpr,
34) -> AstExprBinary {
35    AstExprBinary::new(location, op, left, right)
36}