1/* 2 * Copyright (c) 2022 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 */ 15declare function print(str:any):string; 16var x; 17var mycars = new Array(); 18mycars[0] = "Saab"; 19mycars[1] = "Volvo"; 20mycars[2] = "BMW"; 21// CHECK#1 22var fin = 0; 23var i = 0; 24for (x in mycars) { 25 try { 26 i += 1; 27 continue; 28 } 29 catch (er1) { } 30 finally { 31 fin = 1; 32 } 33 for (x in mycars) { 34 fin = -1; 35 } 36 fin = -1; 37} 38print(fin) 39print(i) 40// CHECK#2 41var c2 = 0, fin2 = 0; 42for (x in mycars) { 43 try { 44 throw "ex1"; 45 } 46 catch (er1) { 47 c2 += 1; 48 continue; 49 } 50 finally { 51 fin2 = 1; 52 } 53 fin2 = -1; 54} 55print(fin2) 56print(c2) 57// CHECK#3 58var c3 = 0, fin3 = 0; 59for (x in mycars) { 60 try { 61 throw "ex1"; 62 } 63 catch (er1) { 64 c3 += 1; 65 } 66 finally { 67 fin3 = 1; 68 continue; 69 } 70 fin3 = 0; 71} 72print(fin3) 73print(c3) 74// CHECK#4 75var fin = 0; 76for (x in mycars) { 77 try { 78 continue; 79 } 80 finally { 81 fin = 1; 82 } 83 fin = -1; 84} 85print(fin) 86// CHECK#5 87var c5 = 0; 88for (x in mycars) { 89 try { 90 throw "ex1"; 91 } 92 catch (er1) { 93 c5 += 1; 94 continue; 95 } 96 c5 += 12; 97} 98print(c5) 99// CHECK#6 100var c6 = 0, fin6 = 0; 101for (x in mycars) { 102 try { 103 c6 += 1; 104 throw "ex1"; 105 } 106 finally { 107 fin6 = 1; 108 continue; 109 } 110 fin6 = -1; 111} 112print(fin6) 113print(c6) 114 115class A { 116 constructor(a:any|number) { 117 try { 118 a = -1234.5678; 119 function f():void {} 120 f(f, a); 121 } finally { 122 Symbol[a] = 1.0 123 } 124 } 125}