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 */
15declare function print(arg:any):string;
16
17function bar() {
18}
19
20function bar2() {
21}
22
23async function foo() {
24    let a:number[] = [];
25    for (let i = 0; i < 1; ++i) {
26        await bar();
27        for (let j = 0; j < 1; ++j) {
28            await bar2();
29        }
30    }
31    print("foo");
32}
33
34function createArray() {
35    return new Array<number>(1);
36}
37
38async function foo2() {
39    let a:Array<number> = createArray();
40    for (let i = 0; i < a.length; ++i) {
41        await bar();
42        for (let j = 0; j < 1; ++j) {
43            await bar2();
44        }
45    }
46    print("foo2");
47}
48
49async function foo3() {
50    for(let i = 0; i<1; ++i) {
51        bar();
52    }
53    for (let i = 0; i < 1; ++i) {
54        await bar();
55        for (let j = 0; j < 1; ++j) {
56            await bar2();
57        }
58    }
59    print("foo3");
60}
61
62foo();
63
64foo2();
65
66foo3();
67