refactor(compiler): 拆分 oxide_emit 为独立 emit pass crate(依赖倒置)

This commit is contained in:
爱特每羊队
2026-08-05 20:13:18 +08:00
parent 9f02985a82
commit bbdfca1a1c
62 changed files with 1045 additions and 993 deletions
+16
View File
@@ -0,0 +1,16 @@
use crate::{CompileCtx, Emitter};
impl Emitter {
pub(crate) fn emit_class_header(
&self, class: &oxide_parser::Class, ctx: &mut CompileCtx,
) -> Result<(u8, u8, Option<u8>), String> {
let ctor_reg = ctx.alloc_reg();
let proto_reg = ctx.alloc_reg();
let super_reg = if let Some(super_expr) = &class.super_class {
Some(self.emit_expression(super_expr, ctx)?)
} else {
None
};
Ok((ctor_reg, proto_reg, super_reg))
}
}