Skip to main content

num_arg1

Function num_arg1 

Source
fn num_arg1<'a>(
    it: &mut Interp,
    t: &Value,
    a: &'a [Value],
    buf: &'a mut Vec<Value>,
) -> Result<&'a [Value], Value>
Expand description

Array.prototype.indexOf(searchElement, fromIndex)。以前は fromIndex (第2引数)を完全に無視し、常に先頭から探索していた。 indexOf/includes/forEach/map/filter 等は仕様上ジェネリックメソッドだが、 以前は this_items を直接使っていたため array-like への .call() が常に 「何も見つからない/反復しない」結果になる同型のバグが複数箇所にあった (join/slice/concat/forEach で修正済みの続き)。 第 2 引数(fromIndex)が Object のときだけ ToNumber して差し替える(例外を伝える。Object 以外は何もしない)。 仕様の順序: this が undefined/null なら先に TypeError、length が 0 なら fromIndex は変換しない。 整数の型付き配列(ObjKind::Bytes)は従来どおり変換しない(デタッチ検査が未対応のため)。