Skip to main content

luaur_ast/methods/
ast_stat_while_ast_stat_while.rs

1use crate::records::ast_expr::AstExpr;
2use crate::records::ast_node::AstNode;
3use crate::records::ast_stat::AstStat;
4use crate::records::ast_stat_block::AstStatBlock;
5use crate::records::ast_stat_while::AstStatWhile;
6use crate::records::location::Location;
7use crate::rtti::AstNodeClass;
8
9impl AstStatWhile {
10    pub fn new(
11        location: Location,
12        condition: *mut AstExpr,
13        body: *mut AstStatBlock,
14        has_do: bool,
15        do_location: Location,
16    ) -> Self {
17        Self {
18            base: AstStat {
19                base: AstNode {
20                    class_index: <Self as crate::rtti::AstNodeClass>::CLASS_INDEX,
21                    location,
22                },
23                has_semicolon: false,
24            },
25            condition,
26            body,
27            has_do,
28            do_location,
29        }
30    }
31}
32
33#[allow(non_snake_case)]
34pub fn ast_stat_while_ast_stat_while(
35    location: Location,
36    condition: *mut AstExpr,
37    body: *mut AstStatBlock,
38    has_do: bool,
39    do_location: Location,
40) -> AstStatWhile {
41    AstStatWhile::new(location, condition, body, has_do, do_location)
42}