mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 03:01:12 +08:00
fix: 修复同步调用参数限制与内建语义错误
This commit is contained in:
@@ -4,9 +4,9 @@ use oxide_types::value::JsValue;
|
||||
|
||||
impl Vm {
|
||||
#[inline(always)]
|
||||
pub(crate) fn dispatch_add(&mut self, rd: usize, a: usize, b: usize) {
|
||||
let lhs = self.regs[a];
|
||||
let rhs = self.regs[b];
|
||||
pub(crate) fn dispatch_add(&mut self, rd: usize, a: usize, b: usize) -> Result<(), String> {
|
||||
let lhs = self.coerce_primitive_bounded(self.regs[a], false)?;
|
||||
let rhs = self.coerce_primitive_bounded(self.regs[b], false)?;
|
||||
if lhs.is_string() || rhs.is_string() {
|
||||
let ls = coercion::to_string(self.kernel_core.string_forge().as_ref(), lhs);
|
||||
let rs = coercion::to_string(self.kernel_core.string_forge().as_ref(), rhs);
|
||||
@@ -17,5 +17,6 @@ impl Vm {
|
||||
let rn = coercion::to_number(rhs, self.kernel_core.string_forge().as_ref());
|
||||
self.regs[rd] = JsValue::float(ln + rn);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user