Skip to main content

luaur_bytecode/records/
bytecode_graph_serializer.rs

1use crate::records::bc_function::{BcFunction, VmConst};
2use crate::records::bytecode_builder::BytecodeBuilder;
3use crate::records::jump_info::JumpInfo;
4use crate::type_aliases::jumps::Jumps;
5use alloc::vec::Vec;
6
7#[derive(Debug)]
8pub struct BytecodeGraphSerializer<'a> {
9    pub(crate) bcb: &'a mut BytecodeBuilder,
10    pub(crate) func: &'a mut BcFunction,
11    pub(crate) jumps: Jumps,
12    pub(crate) error: bool,
13    pub(crate) consts: Option<Vec<u16>>,
14}
15
16impl<'a> BytecodeGraphSerializer<'a> {
17    pub(crate) fn new(bcb: &'a mut BytecodeBuilder, func: &'a mut BcFunction) -> Self {
18        Self {
19            bcb,
20            func,
21            jumps: Vec::new(),
22            error: false,
23            consts: None,
24        }
25    }
26}