use std::{cell::RefCell, rc::Rc};
use crate::ExprLocalVariable;
#[derive(Debug, Clone)]
pub enum Scope {
Block(ScopeBlock),
Function(ScopeFunction),
}
#[derive(Debug, Clone)]
pub struct ScopeBlock {
pub id: usize,
pub max_variables: usize,
pub offset: usize,
pub variables: Vec<Rc<RefCell<VariableInfo>>>,
pub is_loop: bool,
pub labels: Vec<String>,
}
#[derive(Debug, Clone)]
pub struct VariableInfo {
pub name: String,
pub is_reference: bool,
pub offset: usize,
}
#[derive(Debug, Clone)]
pub struct UpvalueInfo {
pub name: String,
pub from: ExprLocalVariable,
}
#[derive(Debug, Clone)]
pub struct ScopeFunction {
pub id: usize,
pub max_variables: usize,
pub upvalues: Vec<UpvalueInfo>,
pub variadic: bool,
}