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 continue loop; 25 } catch (e) { 26 } finally { 27 b++; 28 } 29 } 30 } catch (e) { 31 } finally { 32 a++; 33 } 34 } 35 } catch(e) { 36 } finally { 37 a++; 38 b++; 39 } 40 assert(b == 11); 41 assert(a == 11); 42 43 a = 0; 44 b = 0; 45 try{ 46 loop:for (let i = 0; i < 10; i++) { 47 try { 48 for(let j = 0; j < 10; j++) { 49 try { 50 continue; 51 } catch (e) { 52 } finally { 53 b++; 54 } 55 } 56 } catch (e) { 57 } finally { 58 a++; 59 } 60 } 61 } catch(e) { 62 } finally { 63 a++; 64 b++; 65 } 66 67 assert(b == 101); 68 assert(a == 11); 69} 70