1/* 2 * Copyright (c) 2025 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 foo(f: () => int): int { 17 return f() 18} 19 20// AstNodes inside the trailing lambda are cloned - check that Clone works 21let a = foo() { 22 for (let i = 0; i < 5; i = i + 1) { 23 break 24 } 25 let x = 0 26 while (x < 5) { 27 x = x + 1 28 continue 29 } 30 a: do { 31 x = x - 1 32 continue a 33 break a 34 } while (x > 0) 35 36 switch (x) { 37 case 1: 38 break 39 } 40 return 1 41} 42