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 16// @ts-nocheck 17declare function print(arg: any): string; 18 19function foo(a) { 20 return a[0]; 21} 22 23 24function test() { 25 let a = "123456789012345678901234567890"; 26 let b = "123456789012345678901234567890"; 27 let c = a + b; 28 foo(a); 29 foo(c); 30} 31 32test(); 33ArkTools.printTypedOpProfiler("LOAD_ELEMENT"); 34ArkTools.clearTypedOpProfiler(); 35 36let v2 = new SendableMap(); 37class C3 { 38 constructor(a5, a6) { 39 ({ "length": a5, } = "-39635"); 40 print(a5 % -1713856730); 41 } 42} 43const v9 = new C3(SendableMap, '-39635'); 44 45function testInc() { 46 let x = "filter"["length"] 47 x++ 48 print(x) 49} 50testInc() 51print(ArkTools.isAOTCompiled(testInc)) 52 53function testMore() { 54 let x = "test1"["length"]; 55 print(-x) 56 print(Math.trunc(x)) 57 print(x % 22.3) 58 print(x + "a") 59 print(!x) 60 print(x == "6") 61 print(x || "6") 62 print(x + "6") 63 print(+x) 64 print(String(x)) 65 print(Boolean(x)) 66 print(Number(x)) 67 let arr = new Int32Array(5).fill(x); 68 print(arr[x]) 69 print(x << 1) 70 print(x >>> 1) 71 72 let xx = "test2"["0"]; 73 print(-xx) 74 print(Math.trunc(xx)) 75 print(xx % 22.3) 76 print(xx + "a") 77 print(!xx) 78 print(xx == "6") 79 print(xx || "6") 80 print(xx + "6") 81 print(+xx) 82 print(String(xx)) 83 print(Boolean(xx)) 84 print(Number(xx)) 85 let arrr = new Int32Array(5).fill(xx); 86 print(arrr[xx]) 87 print(xx << 1) 88 print(xx >>> 1) 89 90 let xxx = "test3"[0]; 91 print(-xxx) 92 print(Math.trunc(xxx)) 93 print(xxx % 22.3) 94 print(xxx + "a") 95 print(!xxx) 96 print(xxx == "6") 97 print(xxx || "6") 98 print(xxx + "6") 99 print(+xxx) 100 print(String(xxx)) 101 print(Boolean(xxx)) 102 print(Number(xxx)) 103 let arrrr = new Int32Array(5).fill(xxx); 104 print(arrrr[xxx]) 105 print(xxx << 1) 106 print(xxx >>> 1) 107} 108 109testMore() 110print(ArkTools.isAOTCompiled(testMore)) 111