fix: Array @@species 绑定并暴露真 [[Construct]],隐式返回交付当前 this

This commit is contained in:
2026-09-20 13:07:38 +00:00
parent 28ccbebd52
commit 1a6feadac4
9 changed files with 335 additions and 70 deletions
+5 -1
View File
@@ -42,7 +42,11 @@ impl Vm {
/// 构造调用(Construct(C, args)):native 构造器值传递调用,bytecode 构造器
/// 压构造帧执行(含 derived 构造器 super() 语义),返回值非对象时回退到新对象。
pub(super) fn construct_ctor(&mut self, ctor: JsValue, args: &[JsValue]) -> Result<JsValue, JsValue> {
///
/// # 边界与前提
/// - `ctor` 非可构造值(箭头 / 非构造 native / 普通值)返回 TypeError 的 `Err`;
/// 消费 `last_uncaught_value`,调用方不得再取槽。
pub(crate) fn construct_ctor(&mut self, ctor: JsValue, args: &[JsValue]) -> Result<JsValue, JsValue> {
// IsConstructor 校验:arrow / 非构造 native / 普通值拒绝。
if !is_constructor_value(ctor) {
return Err(oxide_builtins::error::create_type_error(self, "constructor is not a constructor"));