@@ -450,7 +450,7 @@ export class LuaTranspiler {
450450 }
451451
452452 transpileArguments ( params : ts . NodeArray < ts . Expression > ) : string {
453- const parameters = [ ] ;
453+ const parameters : string [ ] = [ ] ;
454454 params . forEach ( param => {
455455 parameters . push ( this . transpileExpression ( param ) ) ;
456456 } ) ;
@@ -476,12 +476,17 @@ export class LuaTranspiler {
476476 case ts . SyntaxKind . ThisKeyword :
477477 return `self.${ property } ` ;
478478 case ts . SyntaxKind . Identifier :
479- let path = ( < ts . Identifier > node . expression ) . text ;
480- return `${ path } .${ property } ` ;
479+ // If identifier is enum translate to raw member
480+ if ( ( type . symbol . flags & ts . SymbolFlags . Enum ) != 0 ) {
481+ return property ;
482+ } else {
483+ let path = ( < ts . Identifier > node . expression ) . text ;
484+ return `${ path } .${ property } ` ;
485+ }
481486 case ts . SyntaxKind . StringLiteral :
482487 case ts . SyntaxKind . NumericLiteral :
483488 case ts . SyntaxKind . ArrayLiteralExpression :
484- path = this . transpileExpression ( node . expression ) ;
489+ let path = this . transpileExpression ( node . expression ) ;
485490 return `${ path } .${ property } ` ;
486491 case ts . SyntaxKind . CallExpression :
487492 path = this . transpileCallExpression ( < ts . CallExpression > node . expression ) ;
@@ -556,9 +561,9 @@ export class LuaTranspiler {
556561 const block = tsEx . getFirstChildOfType < ts . Block > ( node , ts . isBlock ) ;
557562
558563 // Build parameter string
559- let paramNames = [ ] ;
564+ let paramNames : string [ ] = [ ] ;
560565 parameters . forEach ( param => {
561- paramNames . push ( ( < ts . Identifier > param . name ) . escapedText ) ;
566+ paramNames . push ( < string > ( < ts . Identifier > param . name ) . escapedText ) ;
562567 } ) ;
563568
564569 // Build function header
@@ -664,7 +669,7 @@ export class LuaTranspiler {
664669 }
665670
666671 transpileArrayLiteral ( node : ts . ArrayLiteralExpression ) : string {
667- let values = [ ] ;
672+ let values : string [ ] = [ ] ;
668673
669674 node . elements . forEach ( child => {
670675 values . push ( this . transpileExpression ( child ) ) ;
@@ -674,7 +679,7 @@ export class LuaTranspiler {
674679 }
675680
676681 transpileObjectLiteral ( node : ts . ObjectLiteralExpression ) : string {
677- let properties = [ ] ;
682+ let properties : string [ ] = [ ] ;
678683 // Add all property assignments
679684 node . properties . forEach ( assignment => {
680685 const [ key , value ] = tsEx . getChildren ( assignment ) ;
@@ -691,9 +696,9 @@ export class LuaTranspiler {
691696
692697 transpileFunctionExpression ( node : ts . FunctionExpression ) : string {
693698 // Build parameter string
694- let paramNames = [ ] ;
699+ let paramNames : string [ ] = [ ] ;
695700 node . parameters . forEach ( param => {
696- paramNames . push ( tsEx . getFirstChildOfType < ts . Identifier > ( param , ts . isIdentifier ) . escapedText ) ;
701+ paramNames . push ( < string > tsEx . getFirstChildOfType < ts . Identifier > ( param , ts . isIdentifier ) . escapedText ) ;
697702 } ) ;
698703
699704 let result = `function(${ paramNames . join ( "," ) } )\n` ;
0 commit comments