luaur-code-gen 0.1.3

Native (A64/X64) code generation for Luau (Rust).
Documentation
use crate::records::lowering_stats::{FunctionStats_Enable, LoweringStats};

impl LoweringStats {
    pub fn lowering_stats_operator_add_assign(
        &mut self,
        that: &LoweringStats,
    ) -> &mut LoweringStats {
        self.total_functions += that.total_functions;
        self.skipped_functions += that.skipped_functions;
        self.spills_to_slot += that.spills_to_slot;
        self.spills_to_restore += that.spills_to_restore;
        self.max_spill_slots_used =
            core::cmp::max(self.max_spill_slots_used, that.max_spill_slots_used);
        self.blocks_pre_opt += that.blocks_pre_opt;
        self.blocks_post_opt += that.blocks_post_opt;
        self.max_block_instructions =
            core::cmp::max(self.max_block_instructions, that.max_block_instructions);

        self.reg_alloc_errors += that.reg_alloc_errors;
        self.lowering_errors += that.lowering_errors;

        self.block_linearization_stats
            .block_linearization_stats_operator_add_assign(&that.block_linearization_stats);

        if (self.function_stats_flags & FunctionStats_Enable) != 0 {
            self.functions.extend(that.functions.iter().cloned());
        }

        self
    }
}

impl core::ops::AddAssign<&LoweringStats> for LoweringStats {
    #[inline]
    fn add_assign(&mut self, rhs: &LoweringStats) {
        self.lowering_stats_operator_add_assign(rhs);
    }
}

impl core::ops::AddAssign<LoweringStats> for LoweringStats {
    #[inline]
    fn add_assign(&mut self, rhs: LoweringStats) {
        self.lowering_stats_operator_add_assign(&rhs);
    }
}