Skip to main content

luaur_compiler/records/
variable.rs

1use luaur_ast::records::ast_expr::AstExpr;
2
3#[repr(C)]
4#[derive(Debug, Clone, Copy)]
5pub struct Variable {
6    pub(crate) init: *mut AstExpr, // initial value of the variable; filled by trackValues
7    pub(crate) written: bool,      // is the variable ever assigned to? filled by trackValues
8    pub(crate) constant: bool, // is the variable's value a compile-time constant? filled by constantFold
9}
10
11impl luaur_common::records::dense_hash_table::DenseDefault for Variable {
12    fn dense_default() -> Self {
13        Self::default()
14    }
15}
16
17impl Default for Variable {
18    fn default() -> Self {
19        Self {
20            init: core::ptr::null_mut(),
21            written: false,
22            constant: false,
23        }
24    }
25}