1/* 2 * Copyright (c) 2021-2024 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 16 17function main() : int 18{ 19 let l_int = 0; 20 21 class LocalClassLevel1 22 { 23 m_int1 = 11; 24 25 method1() 26 { 27 let l_int2 = 12; 28 assert(this.m_int1 == 11); 29 assert(l_int == 0); 30 l_int = 1; 31 32 class LocalClassLevel2 33 { 34 m_int2 : int = 22; 35 36 method2() { 37 assert(this.m_int2 == 22); 38 assert(l_int2 == 12); 39 l_int2 = 13; 40 } 41 } 42 43 let lcl2 = new LocalClassLevel2(); 44 lcl2.method2(); 45 assert(l_int2 == 13) 46 } 47 } 48 49 let lcl1 = new LocalClassLevel1(); 50 lcl1.method1(); 51 assert(l_int == 1); 52 53 return 0; 54} 55