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* genfunc(a:number, b:number) {
18    var c:number = 0;
19    var d:number = 0;
20    var e:number = 0;
21    if (a > 0) {
22        c = b + 11;
23        d = c + 55;
24        yield c;
25        e = d + 22;
26    } else {
27        c = b + 33;
28        d = c + 66;
29        yield c;
30        e = d + 44;
31    }
32    yield e;
33}
34
35let gen1 = genfunc(1, 2);
36var a = gen1.next().value;
37var b = gen1.next().value;
38
39let gen2 = genfunc(0, 2);
40var c = gen2.next().value;
41var d = gen2.next().value;
42
43print(a);
44print(b);
45print(c);
46print(d);