1/* 2* Copyright (c) Microsoft Corporation. All rights reserved. 3* Copyright (c) 2023 Huawei Device Co., Ltd. 4* Licensed under the Apache License, Version 2.0 (the "License"); 5* you may not use this file except in compliance with the License. 6* You may obtain a copy of the License at 7* 8* http://www.apache.org/licenses/LICENSE-2.0 9* 10* Unless required by applicable law or agreed to in writing, software 11* distributed under the License is distributed on an "AS IS" BASIS, 12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13* See the License for the specific language governing permissions and 14* limitations under the License. 15* 16* This file has been modified by Huawei to verify type inference by adding verification statements. 17*/ 18 19// === tests/cases/conformance/internalModules/codeGeneration/exportCodeGen.ts === 20declare function AssertType(value:any, type:string):void; 21// should replace all refs to 'x' in the body, 22// with fully qualified 23module A { 24 export let x = 12; 25 function lt12() { 26AssertType(x < 12, "boolean"); 27AssertType(x, "number"); 28AssertType(12, "int"); 29 return x < 12; 30 } 31} 32 33// should not fully qualify 'x' 34module B { 35 let x = 12; 36 function lt12() { 37AssertType(x < 12, "boolean"); 38AssertType(x, "number"); 39AssertType(12, "int"); 40 return x < 12; 41 } 42} 43 44// not copied, since not exported 45module C { 46 function no() { 47AssertType(false, "boolean"); 48 return false; 49 } 50} 51 52// copies, since exported 53module D { 54 export function yes() { 55AssertType(true, "boolean"); 56 return true; 57 } 58} 59 60// validate all exportable statements 61module E { 62 export enum Color { Red } 63 export function fn() { } 64 export interface I { id: number } 65 export class C { name: string } 66 export module M { 67 export let x = 42; 68 } 69} 70 71// validate all exportable statements, 72// which are not exported 73module F { 74 enum Color { Red } 75 function fn() { } 76 interface I { id: number } 77 class C { name: string } 78 module M { 79 let x = 42; 80 } 81} 82 83