fix: 脚本顶层 var/function 声明落 globalThis(DEFINE_GLOBAL_PROP 非可配置数据属性)

This commit is contained in:
爱特每羊队
2026-08-10 03:52:17 +08:00
parent 012a8e5110
commit 4d37614e49
11 changed files with 187 additions and 13 deletions
+6
View File
@@ -197,6 +197,12 @@ impl Inst {
Self::new(OpCode::DEFINE_PROP, target, value, key)
}
/// 定义全局 var 绑定数据属性:target 为全局对象,value/key 为寄存器。
/// 属性可写/可枚举/不可配置(脚本顶层 var/function 声明的属性描述符)。
pub fn define_global_prop(target: Operand, value: Operand, key: Operand) -> Self {
Self::new(OpCode::DEFINE_GLOBAL_PROP, target, value, key)
}
/// 静态删除属性:obj 同时放 rd/a 槽,const_idx 为属性名常量下标。
pub fn delete_prop_static(obj: Operand, const_idx: u32) -> Self {
Self::with_ext(OpCode::DELETE_PROP_STATIC, obj, obj, Operand::None, &[const_idx])