mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 19:21:11 +08:00
fix: class 方法/访问器/constructor/prototype 属性描述符(非枚举/只读),新增 DEFINE_PROP_ATTRS/DEFINE_ACCESSOR_ATTRS
- opcode.rs/inst.rs/contract.rs/vm.rs/vm_dispatch_ctrl.rs:新增两个带 attrs 扩展字的 define 指令 (attrs bit0=writable, bit1=enumerable, bit2=configurable,与 PropAttributes 一致) - class/method.rs:方法与非计算访问器改按规范非枚举安装(DefineMethod 语义) - class/prototype.rs:proto.constructor 非枚举;ctor.prototype 三标志全 false(MakeConstructor) - 效果:language/statements/class 1782 pass/948 fail -> 1910 pass/716 fail(+128/-232)
This commit is contained in:
@@ -1459,6 +1459,20 @@ impl Vm {
|
||||
self.dispatch_define_global_prop(rd, a, b)?;
|
||||
}
|
||||
|
||||
|
||||
OpCode::DEFINE_PROP_ATTRS => {
|
||||
let attrs = self.bytecode[self.pc] as u8;
|
||||
self.pc += 1;
|
||||
self.dispatch_define_prop_attrs(rd, a, b, attrs)?;
|
||||
}
|
||||
|
||||
OpCode::DEFINE_ACCESSOR_ATTRS => {
|
||||
let key_word = self.bytecode[self.pc];
|
||||
let attrs = self.bytecode[self.pc + 1] as u8;
|
||||
self.pc += 2;
|
||||
self.dispatch_define_accessor_attrs(rd, a, b, key_word, attrs)?;
|
||||
}
|
||||
|
||||
OpCode::RETURN => match self.dispatch_return(rd) {
|
||||
Ok(Some(result)) => return Ok(result),
|
||||
Ok(None) => {}
|
||||
|
||||
Reference in New Issue
Block a user