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 interface ArkTools { 17 isAOTCompiled(args: any): boolean; 18} 19declare function print(arg:any):string; 20 21let v1 = new Map(); 22let v2 = new Set(); 23let v3 = new Date(); 24class C { 25 constructor(a4, a5, a6) { 26 let v11 = v1; 27 let v22 = v2; 28 let v33 = v3; 29 30 v1 ^= a4; 31 v2 ^= a5; 32 v3 ^= a6; 33 34 v11["has"](1); 35 v22["has"](2); 36 v33["getTime"](); 37 } 38} 39 40function testCallSpecificObjects(): void { 41 const c1 = new C(Map, Set, Date); 42 try { 43 const c2 = new C(1, 1, 1); 44 } catch (e) { } 45} 46 47testCallSpecificObjects(); 48print("testCallSpecificObjects success, isAotCompiled: " + ArkTools.isAOTCompiled(testCallSpecificObjects)); 49