fix: 修复 VM 原型链未继承 Object 原型链问题

This commit is contained in:
爱特每羊队
2026-06-07 22:40:02 +08:00
parent 788a898b01
commit 005b4659f9
2 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -685,6 +685,7 @@ impl Vm {
pub fn new() -> Self {
let kernel = Arc::new(OxideKernel::new(KernelConfig::minimal()));
init_kernel_builtins(&kernel);
let obj_proto = P::clone(&kernel.builtin_world().object_proto);
Self {
regs: [JsValue::undefined(); 256],
pc: 0,
@@ -695,7 +696,7 @@ impl Vm {
kernel,
interned_strings: Vec::new(),
epoch: Epoch::new(),
object_prototype: P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())),
object_prototype: obj_proto,
math_rng_state: 0,
sub_modules: Vec::new(),
sub_module_constants: Vec::new(),