fix: 收紧CALL_NATIVE调用选择

This commit is contained in:
爱特每羊队
2026-06-14 23:58:12 +08:00
parent 21e3693c63
commit 98cc47c212
2 changed files with 22 additions and 11 deletions
-11
View File
@@ -1792,17 +1792,6 @@ impl Compiler {
let first_arg_reg = if arg_regs.is_empty() { 0u8 } else { arg_regs[0] };
let op = match &call.callee {
Expression::Identifier(ident) if ctx.is_builtin(ident.name.as_str()) => OpCode::CALL_NATIVE,
Expression::StaticMemberExpression(m) => {
if let Expression::Identifier(ident) = &m.object {
if ctx.is_builtin(ident.name.as_str()) {
OpCode::CALL_NATIVE
} else {
OpCode::CALL
}
} else {
OpCode::CALL
}
}
_ => OpCode::CALL,
};
ctx.emit(opcode::encode(op, callee_reg, this_reg, first_arg_reg));