• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2/*
3 * Copyright (c) 2024 Huawei Device Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17class Modifier {
18}
19class A extends Modifier {
20    y = 1;
21    z = 2;
22    x = 0;
23
24}
25class B extends Modifier {
26    y = 1;
27    z = 2;
28    x = 0;
29}
30class C extends Modifier {
31    y = 1;
32    z = 2;
33    x = 0;
34}
35class D extends Modifier {
36    y = 1;
37    z = 2;
38    x = 0;
39}
40class E extends Modifier {
41    y = 1;
42    z = 2;
43    x = 5;
44}
45function visit(tag) {
46    tag.x
47    tag.x
48    tag.x
49    tag.x
50    tag.x
51    tag.x
52    tag.x
53    tag.x
54    tag.x
55    tag.x
56    return tag.x;
57}
58
59let total = 0;
60let a = new A();
61let b = new B();
62let c = new C();
63let d = new D();
64let e = new E();
65
66function main(){
67    let result = 0;
68    for (let i = 0; i < 1000; i++) {
69        visit(a);
70        visit(b);
71        visit(c);
72        visit(d);
73        result = visit(e);
74    }
75    print(result)
76}
77main()
78main()
79main()
80main()
81main()
82