array-isarray.tq 710 Bytes
Newer Older
1 2 3 4 5
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

namespace runtime {
6
extern runtime ArrayIsArray(implicit context: Context)(JSAny): JSAny;
7 8 9
}  // namespace runtime

namespace array {
10 11 12 13 14 15 16 17 18 19 20 21 22 23
// ES #sec-array.isarray
javascript builtin ArrayIsArray(js-implicit context: NativeContext)(arg: JSAny):
    JSAny {
  // 1. Return ? IsArray(arg).
  typeswitch (arg) {
    case (JSArray): {
      return True;
    }
    case (JSProxy): {
      // TODO(verwaest): Handle proxies in-place
      return runtime::ArrayIsArray(arg);
    }
    case (JSAny): {
      return False;
24 25
    }
  }
26
}
27
}  // namespace array