feat: 编译管线/类型层 crate 补全多级日志宏 + 关键路径日志

This commit is contained in:
爱特每羊队
2026-08-10 17:56:28 +08:00
parent 61898f8983
commit d3ed1113ef
34 changed files with 421 additions and 1 deletions
+1
View File
@@ -1270,6 +1270,7 @@ impl Emitter {
/// 调用方为 `oxide_compiler::Compiler::compile`:本函数完成 emit 半程,
/// 随后由 `oxide_ir::lower::lower` 降为字节码。
pub fn emit_program(&self, program: &oxide_parser::Program) -> Result<IRFunction, String> {
crate::emit_debug!("emit_program: {} stmts", program.body.len());
let mut ctx = CompileCtx::new();
// 脚本顶层:var/function 声明需落到全局对象,let/const/class 不进全局。
ctx.is_global_scope = true;
+37
View File
@@ -0,0 +1,37 @@
//! emit 日志宏:`emit_error!/warn!/info!/debug!/trace!`,经由 oxide_log 上报。
//! 编译管线属 Kernel 子系统,`OXIDE_LOG=oxide::kernel=debug` 控制本 crate 日志。
#[macro_export]
macro_rules! emit_error {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::ERROR, $($arg)*)
};
}
#[macro_export]
macro_rules! emit_warn {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::WARN, $($arg)*)
};
}
#[macro_export]
macro_rules! emit_info {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::INFO, $($arg)*)
};
}
#[macro_export]
macro_rules! emit_debug {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::DEBUG, $($arg)*)
};
}
#[macro_export]
macro_rules! emit_trace {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::TRACE, $($arg)*)
};
}
+1
View File
@@ -8,6 +8,7 @@
pub mod class;
pub mod closure;
pub mod emit;
mod emit_log;
pub mod emit_ctx;
pub mod expr;
pub mod prepass;