feat: class 私有成员语义(字段/方法/访问器 + brand 检查 + 契约修复)

This commit is contained in:
爱特每羊队
2026-08-09 11:08:36 +08:00
parent e1f0d578fa
commit 915dedb151
41 changed files with 573 additions and 216 deletions
+6 -7
View File
@@ -24,14 +24,13 @@ fn assign_ids(module: &mut CompiledModule, next_id: &mut u32) {
if opcode::opcode(*instr) == OpCode::CREATE_CLOSURE {
let rel = opcode::imm16(*instr) as usize;
// rel 应为 1-based 子模块下标;0 表示无引用(异常输入),按未解析处理。
let flat = if rel > 0 { module.sub_modules.get(rel - 1).map(|s| s.flat_id).unwrap_or(0) } else { 0 };
let flat = if rel > 0 {
module.sub_modules.get(rel - 1).map(|s| s.flat_id).unwrap_or(0)
} else {
0
};
let rd = opcode::rd(*instr);
*instr = opcode::encode(
OpCode::CREATE_CLOSURE,
rd,
(flat & 0xFF) as u8,
((flat >> 8) & 0xFF) as u8,
);
*instr = opcode::encode(OpCode::CREATE_CLOSURE, rd, (flat & 0xFF) as u8, ((flat >> 8) & 0xFF) as u8);
}
}
for sub in &mut module.sub_modules {