1/*
2 * Copyright (c) 2024 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
16class Var {
17    x_: number;
18    constructor(x: number) {
19        this.x_ = x;
20    }
21
22    get getx() {
23        return this.x_;
24    }
25
26    set setx(x: number) {
27        this.x_ = x;
28    }
29}
30
31let globalVar = new Var(0);
32
33function func3() {
34    let curVar = globalVar.getx;
35    ArkTools.iterateFrame();
36    globalVar.setx = curVar;
37}
38
39function func2() {
40    let curVar = globalVar.getx;
41    globalVar.setx = 3;
42    func3();
43    globalVar.setx = curVar;
44}
45
46function func1() {
47    let curVar = globalVar.getx;
48    globalVar.setx = 2;
49    func2();
50    globalVar.setx = curVar;
51}
52
53function func0() {
54    let curVar = globalVar.getx;
55    globalVar.setx = 1;
56    func1();
57    globalVar.setx = curVar;
58}
59
60print(ArkTools.isAOTCompiled(func0));
61print(globalVar.getx);
62func0();
63print(globalVar.getx);