File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -34,4 +34,9 @@ export class LuaTranspilerJIT extends LuaTranspiler52 {
3434 throw TSTLErrors . UnsupportedKind ( "bitwise operator" , node . operatorToken . kind , node ) ;
3535 }
3636 }
37+
38+ /** @override */
39+ public transpileDestructingAssignmentValue ( node : ts . Expression ) : string {
40+ return `table.unpack(${ this . transpileExpression ( node ) } )` ;
41+ }
3742}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export class AssignmentDestructuringTests {
99 let [a, b] = myFunc();` ;
1010
1111 @Test ( "Assignment destructuring [5.1]" )
12- public assignmentDestructuring51 ( ) {
12+ public assignmentDestructuring51 ( ) : void {
1313 // Transpile
1414 const lua = util . transpileString (
1515 this . assignmentDestruturingTs , { luaTarget : LuaTarget . Lua51 , luaLibImport : "none" }
@@ -19,12 +19,22 @@ export class AssignmentDestructuringTests {
1919 }
2020
2121 @Test ( "Assignment destructuring [5.2]" )
22- public tupleDestructing52 ( ) {
22+ public tupleDestructing52 ( ) : void {
2323 // Transpile
2424 const lua = util . transpileString (
2525 this . assignmentDestruturingTs , { luaTarget : LuaTarget . Lua52 , luaLibImport : "none" }
2626 ) ;
2727 // Assert
2828 Expect ( lua ) . toBe ( `local a,b=table.unpack(myFunc());` ) ;
2929 }
30+
31+ @Test ( "Assignment destructuring [JIT]" )
32+ public assignmentDestructuringJIT ( ) : void {
33+ // Transpile
34+ const lua = util . transpileString (
35+ this . assignmentDestruturingTs , { luaTarget : LuaTarget . LuaJIT , luaLibImport : "none" }
36+ ) ;
37+ // Assert
38+ Expect ( lua ) . toBe ( `local a,b=table.unpack(myFunc());` ) ;
39+ }
3040}
You can’t perform that action at this time.
0 commit comments