refactor(builder): route debug logs via trace
This commit is contained in:
@ -83,11 +83,19 @@ impl MirBuilder {
|
||||
ctx.saved_function = self.scope_ctx.current_function.take();
|
||||
ctx.saved_block = self.current_block.take();
|
||||
|
||||
eprintln!(
|
||||
"[DEBUG/create_function_skeleton] Creating function: {}",
|
||||
func_name
|
||||
let trace = crate::mir::builder::control_flow::joinir::trace::trace();
|
||||
trace.emit_if(
|
||||
"debug",
|
||||
"create_function_skeleton",
|
||||
&format!("Creating function: {}", func_name),
|
||||
trace.is_enabled(),
|
||||
);
|
||||
trace.emit_if(
|
||||
"debug",
|
||||
"create_function_skeleton",
|
||||
&format!("Entry block: {:?}", entry),
|
||||
trace.is_enabled(),
|
||||
);
|
||||
eprintln!("[DEBUG/create_function_skeleton] Entry block: {:?}", entry);
|
||||
|
||||
// Phase 136 Step 3/7: Use scope_ctx as SSOT
|
||||
self.scope_ctx.current_function = Some(function);
|
||||
@ -166,17 +174,33 @@ impl MirBuilder {
|
||||
|
||||
/// 🎯 箱理論: Step 4 - 本体lowering
|
||||
fn lower_function_body(&mut self, body: Vec<ASTNode>) -> Result<(), String> {
|
||||
let trace = crate::mir::builder::control_flow::joinir::trace::trace();
|
||||
|
||||
if crate::config::env::joinir_dev_enabled() {
|
||||
let tree = crate::mir::control_tree::StepTreeBuilderBox::build_from_block(&body);
|
||||
crate::mir::builder::control_flow::joinir::trace::trace()
|
||||
.dev("control_tree/step_tree", &tree.to_compact_string());
|
||||
trace.dev("control_tree/step_tree", &tree.to_compact_string());
|
||||
}
|
||||
|
||||
eprintln!("[DEBUG/lower_function_body] body.len() = {}", body.len());
|
||||
trace.emit_if(
|
||||
"debug",
|
||||
"lower_function_body",
|
||||
&format!("body.len() = {}", body.len()),
|
||||
trace.is_enabled(),
|
||||
);
|
||||
let program_ast = function_lowering::wrap_in_program(body);
|
||||
eprintln!("[DEBUG/lower_function_body] About to call build_expression");
|
||||
trace.emit_if(
|
||||
"debug",
|
||||
"lower_function_body",
|
||||
"About to call build_expression",
|
||||
trace.is_enabled(),
|
||||
);
|
||||
let _last = self.build_expression(program_ast)?;
|
||||
eprintln!("[DEBUG/lower_function_body] build_expression completed");
|
||||
trace.emit_if(
|
||||
"debug",
|
||||
"lower_function_body",
|
||||
"build_expression completed",
|
||||
trace.is_enabled(),
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user