Skip to main content

same_kind_as

Function same_kind_as 

Source
pub(crate) fn same_kind_as(
    it: &mut Interp,
    t: &Value,
    items: Vec<Value>,
) -> Value
Expand description

Array.prototype.toSorted/toReversed/toSpliced/with(ES2023)は %TypedArray% にも同名メソッドが仕様化されているが、この処理系ではどれも this が TypedArray (ObjKind::Array を流用し _ta_kind タグで区別)かどうかを見ずに常に素の Obj::array(items) を返しており、new Int8Array([3,1,2]).toSorted()Int8Array ではなく普通の配列に化けるバグだった(structuredClone(TypedArray) と同種)。this_ta_kind を引き継いで返す共通ヘルパーで対応する。