1/* 2 * Copyright (c) 2023-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 16function main() : void{ 17 let a = 0; 18 let b = 0; 19 try { 20 loop:for (let i = 0; i < 10; i++) { 21 try { 22 for(let j = 0; j < 10; j++) { 23 try { 24 break loop; 25 } catch (e) { 26 assert(false); 27 } finally { 28 b++; 29 } 30 } 31 } catch (e) { 32 assert(false); 33 } finally { 34 a++; 35 } 36 } 37 } catch(e) { 38 assert(false); 39 } finally { 40 a++; 41 b++; 42 } 43 assert(b == 2); 44 assert(a == 2); 45 46 a = 0; 47 b = 0; 48 try { 49 loop:for (let i = 0; i < 10; i++) { 50 try { 51 for(let j = 0; j < 10; j++) { 52 try { 53 break; 54 } catch (e) { 55 assert(false); 56 } finally { 57 b++; 58 } 59 } 60 } catch (e) { 61 assert(false); 62 } finally { 63 a++; 64 } 65 } 66 } catch(e) { 67 assert(false); 68 } finally { 69 a++; 70 b++; 71 } 72 assert(b == 11); 73 assert(a == 11); 74} 75