File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -2737,6 +2737,7 @@ export class EmitterLua {
27372737 }
27382738
27392739 private processPostfixUnaryExpression ( node : ts . PostfixUnaryExpression ) : void {
2740+ const op = node . operator == ts . SyntaxKind . PlusPlusToken ? '+' : '-' ;
27402741 switch ( node . operator ) {
27412742 case ts . SyntaxKind . PlusPlusToken :
27422743 case ts . SyntaxKind . MinusMinusToken :
@@ -2745,16 +2746,14 @@ export class EmitterLua {
27452746 this . processExpression ( node . operand ) ;
27462747 this . functionContext . textCode . push ( " = " ) ;
27472748 this . processExpression ( node . operand ) ;
2748- this . functionContext . textCode . push ( " + 1" ) ;
2749+ this . functionContext . textCode . push ( " " + op + " 1") ;
27492750 } else {
27502751 this . functionContext . textCode . push ( "(function () " ) ;
27512752 let opIndex = parseInt ( node . pos . toFixed ( ) ) ;
27522753 if ( opIndex < 0 ) {
27532754 opIndex = 0 ;
27542755 }
27552756
2756- const op = node . operator == ts . SyntaxKind . PlusPlusToken ? '+' : '-' ;
2757-
27582757 this . functionContext . textCode . push ( "local op" + opIndex + " = (" ) ;
27592758 this . processExpression ( node . operand ) ;
27602759 this . functionContext . textCode . push ( ") " ) ;
Original file line number Diff line number Diff line change 1- var someArray = [ 9 , 2 , 5 ] ;
2- for ( var item of someArray ) {
3- console . log ( item ) ;
4- }
1+ let a = 1 ;
2+ let count = 0 ;
3+ while ( a ) {
4+ a -- ;
5+ count ++ ;
6+ }
7+ console . log ( count ) ;
You can’t perform that action at this time.
0 commit comments