1/** 2 * Copyright (c) 2024-2025 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 */ 15class Test { 16 test() { 17 console.log("test") 18 } 19 20 test2() { 21 } 22 23 test2(a: int) { 24 console.log("test2") 25 if(a > 0) { 26 return 1 27 } 28 return -1; 29 } 30 31 test3(a: int) { 32 try { 33 a = a + 1 34 } catch(e){ 35 a = a - 1 36 return a 37 } 38 return a 39 } 40} 41 42function test0() { 43} 44 45function test0(a: int) { 46 console.log("test0 ", a) 47} 48 49function test1(b: String) { 50} 51 52function main() { 53 const test = new Test() 54 test.test() 55 test.test2(1) 56 test0() 57 test1("hgf") 58 test.test2() 59} 60