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 */ 15declare function print(arg:any, arg1?:any):string; 16 17class cpu { 18 public mode: number = 1; 19 constructor() { 20 this.mode = 4; 21 } 22 public static add(a: string):number { 23 let i : number = 3; 24 let b : string = a.substring(3); 25 print(b); 26 let d : number = b.charCodeAt(4); 27 print(a[i]); 28 print(b[i]); 29 return d; 30 } 31} 32 33function foo(a: string):number { 34 let b : string = a.substring(1); 35 let d : number = b.charCodeAt(1); 36 return d; 37} 38 39function foo1(a: string):number { 40 let i : number = 2; 41 let b : string = a.substring(1); 42 let d : number = b.charCodeAt(1); 43 print(a[i]); 44 print(b[i]); 45 return d; 46} 47var a : string = "12345678901234567890" 48var b : string = a.substring(1); 49print(foo(b)) 50print(foo1(b)) 51print(cpu.add(b)) 52print(ArkTools.isAOTCompiled(foo)); 53print(ArkTools.isAOTCompiled(foo1)); 54 55 56function foo2(a: any, b: string) { 57 let v2 = b.substring(a, b); 58 print(v2); 59} 60 61let v0 = 2 >= 1; 62let v1 = "hello" 63print(foo2(v0, v1)); 64print(ArkTools.isAOTCompiled(foo2)); 65 66class c3 { 67 constructor(a8) { 68 let a7 = -4294967297; 69 let v67 = ("Hello, world!").substring(a8, a7); 70 let v68 = ("Hello, world!").slice(a8, a7); 71 let v69 = ("Hello, world!").substr(a8, a7); 72 print(v67); 73 print(v68); 74 print(v69); 75 } 76} 77 78function testc3 () { 79 new c3(-4294967297); 80} 81testc3 () 82print(ArkTools.isAOTCompiled(testc3)); 83