lua_semantics/statement/
localdecl.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::{cell::RefCell, rc::Rc};

pub use lua_parser::Attrib;

use crate::{Expression, VariableInfo};

/// local variable declaration.
#[derive(Clone, Debug)]
pub struct StmtLocalDeclaration {
    /// (stack offset, attribute)
    pub decls: Vec<(Rc<RefCell<VariableInfo>>, Option<Attrib>)>,
    pub values: Option<Vec<Expression>>,
}
impl StmtLocalDeclaration {
    pub fn new(
        decls: Vec<(Rc<RefCell<VariableInfo>>, Option<Attrib>)>,
        values: Option<Vec<Expression>>,
    ) -> Self {
        Self { decls, values }
    }
}