• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
15
16print("testStart");
17
18async function testAwait() {
19    return new Promise(resolve => {
20        resolve("test");
21    });
22}
23function testFunction() {
24    var a = 1;
25    a = 2;
26    a = 3;
27    a = 4;
28    nextFunction();
29    a = 5;
30    a = 6;
31    a = 7;
32    a = 8;
33    a = 9;
34    a = 10;
35    a = 12;
36    async function asyncTest() {
37        var c = 1;
38        c = 2;
39        return 'test';
40    }
41    a = 13;
42    a = 14;
43    asyncTest();
44    a = 15;
45    a = 16;
46    a = 17;
47    a = 18;
48    a = 19;
49    a = 20;
50    async function asyncTest2() {
51        var d = 1;
52        d = 2;
53        var result = await testAwait();
54        d = 3;
55        return result;
56    }
57    asyncTest2();
58    a = 21;
59    a = 22;
60    a = 23;
61    if (a == 23) {
62        a = 100;
63    }
64    a += 1;
65    a += 1;
66    a += 1;
67    a += 1;
68    a += 1;
69    a += 1;
70    a += 1;
71    print("->testFunction end, a:" + a);
72}
73function nextFunction() {
74    print("->nextFunction()");
75    var c = 1;
76    c = 2;
77    c = 3;
78    c = 4;
79    c = 5;
80    c = 6;
81    c = 7;
82}
83print("->testFunction()");
84var b = 1;
85b = 2;
86b = 3;
87b = 4;
88testFunction();
89b = 5;
90b = 6;
91b = 7;
92b = 8;
93b = 9;
94b = 10;
95b = 11;
96b = 12;
97b = 13;
98print("->testEnd");
99