fix: 修复不支持特性直接崩溃问题

This commit is contained in:
爱特每羊队
2026-06-09 10:16:24 +08:00
parent b2540f427b
commit 8bdb589e02
2 changed files with 33 additions and 2 deletions
+9 -2
View File
@@ -908,7 +908,9 @@ impl Compiler {
AssignmentOperator::Division => OpCode::COMPOUND_MEMBER_DIV,
AssignmentOperator::Remainder => OpCode::COMPOUND_MEMBER_MOD,
AssignmentOperator::Exponential => OpCode::COMPOUND_MEMBER_EXP,
_ => unreachable!(),
_ => {
return Err(format!("compound assignment operator {:?} not supported", assign.operator))
}
};
ctx.emit(opcode::encode(op, obj_reg, val_reg, key_reg));
ctx.emit(0);
@@ -947,7 +949,12 @@ impl Compiler {
AssignmentOperator::Division => OpCode::COMPOUND_DIV,
AssignmentOperator::Remainder => OpCode::COMPOUND_MOD,
AssignmentOperator::Exponential => OpCode::COMPOUND_EXP,
_ => unreachable!(),
_ => {
return Err(format!(
"compound assignment operator {:?} not supported",
assign.operator
))
}
};
ctx.emit(opcode::encode(op, var_reg, rhs, 0));
Ok(var_reg)