@@ -1675,16 +1675,27 @@ export class LuaTransformer {
16751675 for ( const enumMember of this . computeEnumMembers ( enumDeclaration ) ) {
16761676 const memberName = this . transformPropertyName ( enumMember . name ) ;
16771677 if ( membersOnly ) {
1678+ const enumSymbol = this . checker . getSymbolAtLocation ( enumDeclaration . name ) ;
1679+ const exportScope = enumSymbol ? this . getSymbolExportScope ( enumSymbol ) : undefined ;
1680+
16781681 if ( tstl . isIdentifier ( memberName ) ) {
16791682 result . push (
1680- ...this . createLocalOrExportedOrGlobalDeclaration ( memberName , enumMember . value , enumDeclaration )
1683+ ...this . createLocalOrExportedOrGlobalDeclaration (
1684+ memberName ,
1685+ enumMember . value ,
1686+ enumDeclaration ,
1687+ undefined ,
1688+ exportScope
1689+ )
16811690 ) ;
16821691 } else {
16831692 result . push (
16841693 ...this . createLocalOrExportedOrGlobalDeclaration (
16851694 tstl . createIdentifier ( enumMember . name . getText ( ) , enumMember . name ) ,
16861695 enumMember . value ,
1687- enumDeclaration
1696+ enumDeclaration ,
1697+ undefined ,
1698+ exportScope
16881699 )
16891700 ) ;
16901701 }
@@ -4087,7 +4098,16 @@ export class LuaTransformer {
40874098 const decorators = tsHelper . getCustomDecorators ( type , this . checker ) ;
40884099 // Do not output path for member only enums
40894100 if ( decorators . has ( DecoratorKind . CompileMembersOnly ) ) {
4090- return tstl . createIdentifier ( property , expression ) ;
4101+ if ( ts . isPropertyAccessExpression ( expression . expression ) ) {
4102+ // in case of ...x.enum.y transform to ...x.y
4103+ return tstl . createTableIndexExpression (
4104+ this . transformExpression ( expression . expression . expression ) ,
4105+ tstl . createStringLiteral ( property ) ,
4106+ expression
4107+ ) ;
4108+ } else {
4109+ return tstl . createIdentifier ( property , expression ) ;
4110+ }
40914111 }
40924112
40934113 if ( decorators . has ( DecoratorKind . LuaTable ) ) {
@@ -5161,7 +5181,8 @@ export class LuaTransformer {
51615181 lhs : tstl . Identifier | tstl . Identifier [ ] ,
51625182 rhs ?: tstl . Expression | tstl . Expression [ ] ,
51635183 tsOriginal ?: ts . Node ,
5164- parent ?: tstl . Node
5184+ parent ?: tstl . Node ,
5185+ overrideExportScope ?: ts . SourceFile | ts . ModuleDeclaration
51655186 ) : tstl . Statement [ ] {
51665187 let declaration : tstl . VariableDeclarationStatement | undefined ;
51675188 let assignment : tstl . AssignmentStatement | undefined ;
@@ -5173,7 +5194,7 @@ export class LuaTransformer {
51735194 return [ ] ;
51745195 }
51755196
5176- const exportScope = this . getIdentifierExportScope ( identifiers [ 0 ] ) ;
5197+ const exportScope = overrideExportScope || this . getIdentifierExportScope ( identifiers [ 0 ] ) ;
51775198 if ( exportScope ) {
51785199 // exported
51795200 if ( ! rhs ) {
0 commit comments