fix: 清理 CallFrame 无效字段并接入函数名元数据

This commit is contained in:
爱特每羊队
2026-06-08 22:11:55 +08:00
parent a715a3ac21
commit 22cbccdf6c
3 changed files with 43 additions and 11 deletions
+6 -2
View File
@@ -377,8 +377,9 @@ impl Compiler {
};
// Compile body into sub-module
let sub_module =
let mut sub_module =
self.compile_function_body(&param_names, body_stmts, ctx, false)?;
sub_module.function_name = Some(name.clone());
ctx.sub_modules.push(sub_module);
// 1-indexed: 0 = no sub_module (sentinel)
let sub_idx = ctx.sub_modules.len() as u32;
@@ -1223,8 +1224,11 @@ impl Compiler {
&[]
};
let sub_module =
let mut sub_module =
self.compile_function_body(&param_names, body_stmts, ctx, false)?;
if let Some(id) = &fe.id {
sub_module.function_name = Some(id.name.to_string());
}
ctx.sub_modules.push(sub_module);
// 1-indexed: 0 = no sub_module (sentinel)
let sub_idx = ctx.sub_modules.len() as u32;