• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5namespace runtime {
6extern runtime ArrayIsArray(implicit context: Context)(JSAny): JSAny;
7}  // namespace runtime
8
9namespace array {
10// ES #sec-array.isarray
11javascript builtin ArrayIsArray(js-implicit context: NativeContext)(arg: JSAny):
12    JSAny {
13  // 1. Return ? IsArray(arg).
14  typeswitch (arg) {
15    case (JSArray): {
16      return True;
17    }
18    case (JSProxy): {
19      // TODO(verwaest): Handle proxies in-place
20      return runtime::ArrayIsArray(arg);
21    }
22    case (JSAny): {
23      return False;
24    }
25  }
26}
27}  // namespace array
28