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
16declare function print(arg:any):string;
17
18let d = {x:1, y:2}
19d.x = 3;
20print(d.x);
21
22function foo(obj) {
23   let ret;
24   for (let i = 0; i < 10000; i++) {
25       ret = obj.x
26   }
27   return ret
28}
29
30let a = {x:1, y: 2}
31
32let b = {x:2, y: 3}
33
34print(foo(a));
35print(foo(b));
36
37
38var originObject = {
39    func() {
40        return {
41            index: 0,
42            next() {
43                return {
44                    value: this.val,
45                    done: this.isDone
46                };
47            },
48            isDone: false,
49            get val() {
50                this.index++;
51                if (this.index > 7) {
52                    this.isDone = true;
53                }
54                return 1 << this.index;
55            }
56        };
57    },
58    0: "lighter",
59    1: "normal",
60    2: "regular",
61    3: "medium",
62    wode: 55,
63    "hhh": "wwww",
64    func1: function(a) {
65        print(a);
66    }
67};
68
69Object.keys(originObject).forEach(
70    function(key) {
71        print(key);
72        print(originObject[key]);
73    }
74);
75
76var funn =  originObject.func();
77
78Object.keys(funn).forEach(
79    function(key) {
80        print(key);
81        print(funn[key]);
82    }
83);