• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16declare var ArkTools:any;
17declare function print(arg:any):string;
18class Code {
19    _bases: Base[] = new Array();
20
21    addBase(): Base {
22      let base = new Base();
23      let result = base;
24      this._bases.push(result);
25      return result;
26    }
27
28    hash() {
29      this._bases[0].successorBases()
30    }
31  }
32
33class Base {
34  _successors = []
35
36  successorBases()  {
37    return this.successors;
38  }
39
40  get successors(){
41    return this._successors;
42  }
43
44  [Symbol.iterator]() {
45    return 1
46  }
47}
48
49function createTest(): Code {
50  let code =  new Code();
51  let bb0 = code.addBase();
52  let bb1 = code.addBase();
53  return code
54}
55
56function runIteration(): void {
57  let code = createTest()
58  code.hash()
59}
60
61let i;
62for (i = 0; i < 10; i++) {
63  runIteration();
64}
65print(i)
66
67print(ArkTools.isAOTCompiled(createTest))
68print(ArkTools.isAOTCompiled(runIteration))