1/*
2 * Copyright (c) 2023 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/*
17 * @tc.name:throwerror
18 * @tc.desc:test throwerror
19 * @tc.type: FUNC
20 */
21function f1(a2, a3) {
22    g = 256;
23}
24try {
25    ([1,2]).filter(f1);
26} catch (e) {
27    print(e.name);
28}
29
30function f0(a1) {
31    return a1 in "valueOf";
32}
33const v4 = [4294967297];
34try {
35    ([1,2]).reduce(f0, v4);
36} catch (e) {
37    print(e.name);
38}
39
40function f2(a1) {
41    return f2;
42}
43class C2 extends f2 {
44}
45C2.__proto__ = [8069];
46try {
47    new C2();
48} catch (e) {
49    print(e.name);
50}
51
52class C3 {
53    #a = "2F";
54}
55try {
56    C3(..."g2");
57} catch (e) {
58    print(e.name);
59}
60
61try {
62    const v40 = [1, -3.0];
63    v40[1] = v40;
64    print(v40.flat(536870887));
65} catch (e) {
66    print(e)
67}