1/*
2 * Copyright (c) 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 */
15declare function print(arg:any):void;
16
17function tryHello(v: number): void {
18    let a: number = 1;
19    let ret: number = a + v;
20    print(ret);
21}
22print(ArkTools.checkDeoptStatus(tryHello, false));
23tryHello(<number><Object>'a');
24print(ArkTools.checkDeoptStatus(tryHello, true));
25for (let i = 0; i < 25; i++) {
26    tryHello(<number><Object>'a');
27}
28print(ArkTools.checkDeoptStatus(tryHello, true));
29
30function tryIf(v: number, b: number): void {
31    let a : number = 1;
32
33    if (b == 1) {
34        let ret: number = a + v;
35        print(ret);
36    }
37}
38tryIf(<number><Object>'a', 1);
39
40function tryPhi(v: number, b: number): void {
41    let a : number = 1;
42    let ret: number = 1;
43    if (b == 1) {
44        ret = a + v;
45    }
46    print(ret);
47}
48
49tryPhi(<number><Object>'a', 1);
50
51function tryLoop(v: number, b: number): void {
52    let a : number = 1;
53    let ret: number = 1;
54
55    for (var i = 0; i < b; i++) {
56        ret = a + v;
57    }
58    print(ret);
59}
60
61tryLoop(<number><Object>'a', 1);
62