File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export abstract class LuaTranspiler {
7171 public makeExport ( name : string | ts . __String , node : ts . Node , dummy ?: boolean ) : string {
7272 let result : string = "" ;
7373 if ( node &&
74- node . modifiers &&
74+ node . modifiers && this . isModule &&
7575 ( ts . getCombinedModifierFlags ( node ) & ts . ModifierFlags . Export )
7676 ) {
7777 if ( dummy ) {
Original file line number Diff line number Diff line change 11import { Expect , Test , TestCase } from "alsatian" ;
22import * as ts from "typescript" ;
3- import { LuaTarget , LuaTranspiler } from "../../src/Transpiler" ;
3+
44import * as util from "../src/util" ;
55
66export class LuaModuleTests {
@@ -34,4 +34,13 @@ export class LuaModuleTests {
3434 Expect ( ( ) => transpiler . transpileImport ( mockDeclaration as ts . ImportDeclaration ) )
3535 . toThrowError ( Error , "Unsupported import type." ) ;
3636 }
37+
38+ @Test ( "Non-exported module" )
39+ public nonExportedModule ( ) {
40+ const lua = util . transpileString ( "module g { export function test() { return 3; } } return g.test();" ) ;
41+
42+ const result = util . executeLua ( lua ) ;
43+
44+ Expect ( result ) . toBe ( 3 ) ;
45+ }
3746}
You can’t perform that action at this time.
0 commit comments