1/* 2 * Copyright (c) 2023 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 */ 15var globalFunc = null; 16 17function func() { 18 let v1 = 1; 19 function func2() { 20 var v2_1 = 2; 21 const v2_2 = 3; 22 function func3() { 23 const v3 = 4; 24 print(v1); 25 print(v2_1) 26 function func4() { 27 let v4 = 5; 28 print(v2_2); 29 function func5() { 30 print(v3); 31 print(v1); 32 } 33 return func5; 34 } 35 return func4; 36 } 37 return func3; 38 } 39 return func2; 40} 41 42function func6() { 43 var a = 10; 44 for (let i = 0; i < 10; i++) { 45 print(a); 46 function func7() { 47 let b = 3; 48 print(i); 49 print(i+1); 50 } 51 if (i == 5) { 52 globalFunc = function func8() { 53 print(a); 54 print(i); 55 print(a+1); 56 } 57 } 58 } 59} 60 61const func2 = func(); 62const func3 = func2(); 63const func4 = func3(); 64const func5 = func4(); 65func5(); 66func6(); 67globalFunc();