1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ECMASCRIPT_BUILTINS_BUILTINS_ARRAY_H 17 #define ECMASCRIPT_BUILTINS_BUILTINS_ARRAY_H 18 19 #include "ecmascript/base/builtins_base.h" 20 21 namespace panda::ecmascript::builtins { 22 static constexpr uint8_t INDEX_TWO = 2; 23 static constexpr uint8_t INDEX_THREE = 3; 24 class BuiltinsArray : public base::BuiltinsBase { 25 public: 26 // 22.1.1 27 static JSTaggedValue ArrayConstructor(EcmaRuntimeCallInfo *argv); 28 29 // 22.1.2.1 30 static JSTaggedValue From(EcmaRuntimeCallInfo *argv); 31 // 22.1.2.2 32 static JSTaggedValue IsArray(EcmaRuntimeCallInfo *argv); 33 // 22.1.2.3 34 static JSTaggedValue Of(EcmaRuntimeCallInfo *argv); 35 // 22.1.2.5 36 static JSTaggedValue Species(EcmaRuntimeCallInfo *argv); 37 38 // prototype 39 // 22.1.3.1 40 static JSTaggedValue Concat(EcmaRuntimeCallInfo *argv); 41 // 22.1.3.3 42 static JSTaggedValue CopyWithin(EcmaRuntimeCallInfo *argv); 43 // 22.1.3.4 44 static JSTaggedValue Entries(EcmaRuntimeCallInfo *argv); 45 // 22.1.3.5 46 static JSTaggedValue Every(EcmaRuntimeCallInfo *argv); 47 // 22.1.3.6 48 static JSTaggedValue Fill(EcmaRuntimeCallInfo *argv); 49 // 22.1.3.7 50 static JSTaggedValue Filter(EcmaRuntimeCallInfo *argv); 51 // 22.1.3.8 52 static JSTaggedValue Find(EcmaRuntimeCallInfo *argv); 53 // 22.1.3.9 54 static JSTaggedValue FindIndex(EcmaRuntimeCallInfo *argv); 55 // 22.1.3.10 56 static JSTaggedValue ForEach(EcmaRuntimeCallInfo *argv); 57 // 22.1.3.11 58 static JSTaggedValue IndexOf(EcmaRuntimeCallInfo *argv); 59 // 22.1.3.12 60 static JSTaggedValue Join(EcmaRuntimeCallInfo *argv); 61 // 22.1.3.13 62 static JSTaggedValue Keys(EcmaRuntimeCallInfo *argv); 63 // 22.1.3.14 64 static JSTaggedValue LastIndexOf(EcmaRuntimeCallInfo *argv); 65 // 22.1.3.15 66 static JSTaggedValue Map(EcmaRuntimeCallInfo *argv); 67 // 22.1.3.16 68 static JSTaggedValue Pop(EcmaRuntimeCallInfo *argv); 69 // 22.1.3.17 70 static JSTaggedValue Push(EcmaRuntimeCallInfo *argv); 71 // 22.1.3.18 72 static JSTaggedValue Reduce(EcmaRuntimeCallInfo *argv); 73 // 22.1.3.19 74 static JSTaggedValue ReduceRight(EcmaRuntimeCallInfo *argv); 75 // 22.1.3.20 76 static JSTaggedValue Reverse(EcmaRuntimeCallInfo *argv); 77 // 22.1.3.21 78 static JSTaggedValue Shift(EcmaRuntimeCallInfo *argv); 79 // 22.1.3.22 80 static JSTaggedValue Slice(EcmaRuntimeCallInfo *argv); 81 // 22.1.3.23 82 static JSTaggedValue Some(EcmaRuntimeCallInfo *argv); 83 // 22.1.3.24 84 static JSTaggedValue Sort(EcmaRuntimeCallInfo *argv); 85 // 22.1.3.25 86 static JSTaggedValue Splice(EcmaRuntimeCallInfo *argv); 87 // 22.1.3.26 88 static JSTaggedValue ToLocaleString(EcmaRuntimeCallInfo *argv); 89 // 22.1.3.27 90 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 91 // 22.1.3.28 92 static JSTaggedValue Unshift(EcmaRuntimeCallInfo *argv); 93 // 22.1.3.29 94 static JSTaggedValue Values(EcmaRuntimeCallInfo *argv); 95 // 22.1.3.31 96 static JSTaggedValue Unscopables(EcmaRuntimeCallInfo *argv); 97 // es12 23.1.3.13 98 static JSTaggedValue Includes(EcmaRuntimeCallInfo *argv); 99 // es12 23.1.3.10 100 static JSTaggedValue Flat(EcmaRuntimeCallInfo *argv); 101 // es12 23.1.3.11 102 static JSTaggedValue FlatMap(EcmaRuntimeCallInfo *argv); 103 }; 104 } // namespace panda::ecmascript::builtins 105 106 #endif // ECMASCRIPT_BUILTINS_BUILTINS_ARRAY_H