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 */ 15 16declare function print(str: any): string; 17function* genFun() { 18 let t = 0; 19 for (var i = 0; i < 2; i += 1) { 20 for (var j = 0; j < 2; j += 1) { 21 for (var k = 0; k < 1; k += 1) { 22 t++; 23 yield t * 10000; 24 } 25 for (var k = 0; k < 2; k += 1) { 26 try { 27 yield i * 1000 + j * 100 + k * 10 + t; 28 } catch (e) { 29 print(e); 30 } 31 } 32 } 33 } 34} 35 36var func = genFun(); 37print(func.next().value); 38print(func.next().value); 39print(func.next().value); 40print(func.next().value); 41print(func.next().value); 42print(func.next().value); 43print(func.next().value); 44print(func.next().value); 45print(func.next().value);