fix: Array 方法 array-like receiver/Get 异常传播、species 构造、slice/toSpliced/toSorted 规范化,数组字面量空洞语义

This commit is contained in:
爱特每羊队
2026-08-12 12:51:28 +08:00
parent 3e61b573db
commit 3e8cf3eb23
2 changed files with 351 additions and 146 deletions
@@ -22,6 +22,12 @@ impl Emitter {
ctx.inst(Inst::new(OpCode::NEW_ARRAY, Operand::Reg(arr_reg), Operand::Imm(n), Operand::None));
for (i, elem) in arr.elements.iter().enumerate() {
let Some(e) = elem.as_expression() else {
// hole?????????????????????????
// ??? delete ?????? hole meta?length ????
let scratch = ctx.alloc_reg();
ctx.inst(Inst::inst_mov(Operand::Reg(scratch), Operand::Reg(arr_reg)));
let idx = ctx.add_constant(Constant::Int(i as i32));
ctx.inst(Inst::delete_prop_static(Operand::Reg(scratch), idx as u32));
continue;
};
let val_reg = self.emit_expression(e, ctx)?;