feat: 搭建字节码函数调用基础设施

This commit is contained in:
2026-06-07 16:18:20 +08:00
parent 546d9db338
commit a232cb6969
5 changed files with 183 additions and 8 deletions
+7 -6
View File
@@ -791,12 +791,13 @@ impl Compiler {
} else {
arg_regs[0]
};
ctx.emit(opcode::encode(
OpCode::CALL,
callee_reg,
this_reg,
first_arg_reg,
));
let op = match &call.callee {
Expression::Identifier(ident) if ctx.is_builtin(ident.name.as_str()) => {
OpCode::CALL_NATIVE
}
_ => OpCode::CALL,
};
ctx.emit(opcode::encode(op, callee_reg, this_reg, first_arg_reg));
ctx.emit(arg_regs.len() as u32);
Ok(0u8)
}