@@ -3331,7 +3331,13 @@ export class LuaTransformer {
33313331 const expression = this . expectExpression ( this . transformExpression ( element . initializer ) ) ;
33323332 properties . push ( tstl . createTableFieldExpression ( expression , name , element ) ) ;
33333333 } else if ( ts . isShorthandPropertyAssignment ( element ) ) {
3334- const identifier = this . transformIdentifierExpression ( element . name ) ;
3334+ let identifier = this . transformIdentifierExpression ( element . name ) ;
3335+ if ( tstl . isIdentifier ( identifier ) ) {
3336+ const valueSymbol = this . checker . getShorthandAssignmentValueSymbol ( element ) ;
3337+ if ( valueSymbol !== undefined && this . isSymbolExported ( valueSymbol ) ) {
3338+ identifier = this . createExportedIdentifier ( identifier ) ;
3339+ }
3340+ }
33353341 properties . push ( tstl . createTableFieldExpression ( identifier , name , element ) ) ;
33363342 } else if ( ts . isMethodDeclaration ( element ) ) {
33373343 const expression = this . expectExpression ( this . transformFunctionExpression ( element ) ) ;
@@ -4692,12 +4698,16 @@ export class LuaTransformer {
46924698 }
46934699
46944700 protected isIdentifierExported ( identifier : tstl . Identifier ) : boolean {
4695- if ( ! this . isModule && ! this . currentNamespace ) {
4701+ const symbolInfo = identifier . symbolId && this . symbolInfo . get ( identifier . symbolId ) ;
4702+ if ( ! symbolInfo ) {
46964703 return false ;
46974704 }
46984705
4699- const symbolInfo = identifier . symbolId && this . symbolInfo . get ( identifier . symbolId ) ;
4700- if ( ! symbolInfo ) {
4706+ return this . isSymbolExported ( symbolInfo . symbol ) ;
4707+ }
4708+
4709+ protected isSymbolExported ( symbol : ts . Symbol ) : boolean {
4710+ if ( ! this . isModule && ! this . currentNamespace ) {
47014711 return false ;
47024712 }
47034713
@@ -4706,9 +4716,10 @@ export class LuaTransformer {
47064716 throw TSTLErrors . UndefinedScope ( ) ;
47074717 }
47084718
4709- const scopeSymbol = this . checker . getSymbolAtLocation ( currentScope )
4710- ? this . checker . getSymbolAtLocation ( currentScope )
4711- : this . checker . getTypeAtLocation ( currentScope ) . getSymbol ( ) ;
4719+ let scopeSymbol = this . checker . getSymbolAtLocation ( currentScope ) ;
4720+ if ( scopeSymbol === undefined ) {
4721+ scopeSymbol = this . checker . getTypeAtLocation ( currentScope ) . getSymbol ( ) ;
4722+ }
47124723
47134724 if ( scopeSymbol === undefined || scopeSymbol . exports === undefined ) {
47144725 return false ;
@@ -4718,8 +4729,8 @@ export class LuaTransformer {
47184729 const it : Iterable < ts . Symbol > = {
47194730 [ Symbol . iterator ] : ( ) => scopeSymbolExports . values ( ) , // Why isn't ts.SymbolTable.values() iterable?
47204731 } ;
4721- for ( const symbol of it ) {
4722- if ( symbol === symbolInfo . symbol ) {
4732+ for ( const exportedSymbol of it ) {
4733+ if ( exportedSymbol === symbol ) {
47234734 return true ;
47244735 }
47254736 }
0 commit comments