@@ -384,6 +384,8 @@ export class LuaTranspiler {
384384 return this . transpileArrayLiteral ( < ts . ArrayLiteralExpression > node ) ;
385385 case ts . SyntaxKind . ObjectLiteralExpression :
386386 return this . transpileObjectLiteral ( < ts . ObjectLiteralExpression > node ) ;
387+ case ts . SyntaxKind . DeleteExpression :
388+ return this . transpileExpression ( ( < ts . DeleteExpression > node ) . expression ) + "=nil" ;
387389 case ts . SyntaxKind . FunctionExpression :
388390 case ts . SyntaxKind . ArrowFunction :
389391 return this . transpileArrowFunction ( < ts . ArrowFunction > node ) ;
@@ -410,7 +412,7 @@ export class LuaTranspiler {
410412 // Transpile operands
411413 const lhs = this . transpileExpression ( node . left , true ) ;
412414 const rhs = this . transpileExpression ( node . right , true ) ;
413-
415+
414416 // Rewrite some non-existant binary operators
415417 let result = "" ;
416418 switch ( node . operatorToken . kind ) {
@@ -581,6 +583,9 @@ export class LuaTranspiler {
581583 const caller = this . transpileExpression ( expression . expression ) ;
582584 switch ( expression . name . escapedText ) {
583585 case "push" :
586+ if ( node . arguments . length > 1 ) {
587+ throw new TranspileError ( "Unsupported array function: " + expression . name . escapedText + " with more than one argument" , node ) ;
588+ }
584589 return `table.insert(${ caller } , ${ params } )` ;
585590 case "forEach" :
586591 return `TS_forEach(${ caller } , ${ params } )` ;
@@ -594,6 +599,8 @@ export class LuaTranspiler {
594599 return `TS_every(${ caller } , ${ params } )` ;
595600 case "slice" :
596601 return `TS_slice(${ caller } , ${ params } )`
602+ case "splice" :
603+ return `TS_splice(${ caller } , ${ params } )`
597604 default :
598605 throw new TranspileError ( "Unsupported array function: " + expression . name . escapedText , node ) ;
599606 }
@@ -616,7 +623,7 @@ export class LuaTranspiler {
616623
617624 transpilePropertyAccessExpression ( node : ts . PropertyAccessExpression ) : string {
618625 const property = node . name . text ;
619-
626+
620627 // Check for primitive types to override
621628 const type = this . checker . getTypeAtLocation ( node . expression ) ;
622629 switch ( type . flags ) {
@@ -824,7 +831,7 @@ export class LuaTranspiler {
824831 // Add static declarations
825832 for ( const field of staticFields ) {
826833 const fieldName = ( < ts . Identifier > field . name ) . escapedText ;
827- let value = this . transpileExpression ( field . initializer ) ;
834+ let value = this . transpileExpression ( field . initializer ) ;
828835 result += this . indent + `${ className } .${ fieldName } = ${ value } \n` ;
829836 }
830837
0 commit comments