diff --git a/src/Transpiler.ts b/src/Transpiler.ts index 74c1b1ddc..1ba744de7 100644 --- a/src/Transpiler.ts +++ b/src/Transpiler.ts @@ -263,9 +263,9 @@ export abstract class LuaTranspiler { case ts.SyntaxKind.FunctionDeclaration: return this.transpileFunctionDeclaration(node as ts.FunctionDeclaration); case ts.SyntaxKind.VariableStatement: - return this.indent + this.transpileVariableStatement(node as ts.VariableStatement) + "\n"; + return this.indent + this.transpileVariableStatement(node as ts.VariableStatement) + ";\n"; case ts.SyntaxKind.ExpressionStatement: - return this.indent + this.transpileExpression((node as ts.ExpressionStatement).expression) + "\n"; + return this.indent + this.transpileExpression((node as ts.ExpressionStatement).expression) + ";\n"; case ts.SyntaxKind.ReturnStatement: return this.indent + this.transpileReturn(node as ts.ReturnStatement) + "\n"; case ts.SyntaxKind.IfStatement: @@ -491,7 +491,7 @@ export abstract class LuaTranspiler { // Add header let result = ""; for (const variableDeclaration of (node.initializer as ts.VariableDeclarationList).declarations) { - result += this.indent + this.transpileVariableDeclaration(variableDeclaration); + result += this.indent + this.transpileVariableDeclaration(variableDeclaration) + "\n"; } result += this.indent + `while(${this.transpileExpression(node.condition)}) do\n`; @@ -1407,9 +1407,9 @@ export abstract class LuaTranspiler { const identifierName = this.transpileIdentifier(node.name); if (node.initializer) { const value = this.transpileExpression(node.initializer); - return `local ${identifierName} = ${value}\n`; + return `local ${identifierName} = ${value}`; } else { - return `local ${identifierName} = nil\n`; + return `local ${identifierName} = nil`; } } else if (ts.isArrayBindingPattern(node.name)) { // Destructuring type @@ -1423,9 +1423,9 @@ export abstract class LuaTranspiler { // Don't unpack TupleReturn decorated functions if (tsHelper.isTupleReturnCall(node.initializer, this.checker)) { - return `local ${vars}=${this.transpileExpression(node.initializer)}\n`; + return `local ${vars}=${this.transpileExpression(node.initializer)}`; } else { - return `local ${vars}=${this.transpileDestructingAssignmentValue(node.initializer)}\n`; + return `local ${vars}=${this.transpileDestructingAssignmentValue(node.initializer)}`; } } else { throw TSTLErrors.UnsupportedKind("variable declaration", node.name.kind, node); diff --git a/test/translation/lua/callNamespace.lua b/test/translation/lua/callNamespace.lua index 01c06904d..6d3add272 100644 --- a/test/translation/lua/callNamespace.lua +++ b/test/translation/lua/callNamespace.lua @@ -1 +1 @@ -Namespace.myFunction() \ No newline at end of file +Namespace.myFunction(); \ No newline at end of file diff --git a/test/translation/lua/characterEscapeSequence.lua b/test/translation/lua/characterEscapeSequence.lua index ddb2fa547..239d2b9a5 100644 --- a/test/translation/lua/characterEscapeSequence.lua +++ b/test/translation/lua/characterEscapeSequence.lua @@ -1,18 +1,9 @@ -local quoteInDoubleQuotes = "\' \' \'" - -local quoteInTemplateString = "\' \' \'" - -local doubleQuoteInQuotes = "\" \" \"" - -local doubleQuoteInDoubleQuotes = "\" \" \"" - -local doubleQuoteInTemplateString = "\" \" \"" - -local escapedCharsInQuotes = "\\ \0 \b \t \n \v \f \" \' \`" - -local escapedCharsInDoubleQUotes = "\\ \0 \b \t \n \v \f \" \' \`" - -local escapedCharsInTemplateString = "\\ \0 \b \t \n \v \f \" \' \`" - -local nonEmptyTemplateString = "Level 0: \n\t "..tostring("Level 1: \n\t\t "..tostring("Level 3: \n\t\t\t "..tostring("Last level \n --").." \n --").." \n --").." \n --" - +local quoteInDoubleQuotes = "\' \' \'"; +local quoteInTemplateString = "\' \' \'"; +local doubleQuoteInQuotes = "\" \" \""; +local doubleQuoteInDoubleQuotes = "\" \" \""; +local doubleQuoteInTemplateString = "\" \" \""; +local escapedCharsInQuotes = "\\ \0 \b \t \n \v \f \" \' \`"; +local escapedCharsInDoubleQUotes = "\\ \0 \b \t \n \v \f \" \' \`"; +local escapedCharsInTemplateString = "\\ \0 \b \t \n \v \f \" \' \`"; +local nonEmptyTemplateString = "Level 0: \n\t "..tostring("Level 1: \n\t\t "..tostring("Level 3: \n\t\t\t "..tostring("Last level \n --").." \n --").." \n --").." \n --"; diff --git a/test/translation/lua/do.lua b/test/translation/lua/do.lua index 2f867a7e6..33816ff7a 100644 --- a/test/translation/lua/do.lua +++ b/test/translation/lua/do.lua @@ -1,8 +1,7 @@ -local e = 10 - +local e = 10; repeat do - e = (e-1) + e = (e-1); end ::__continue0:: until not (e>0) diff --git a/test/translation/lua/dotColonFunctionCalls.lua b/test/translation/lua/dotColonFunctionCalls.lua index a70d2d0f2..8ffa06577 100644 --- a/test/translation/lua/dotColonFunctionCalls.lua +++ b/test/translation/lua/dotColonFunctionCalls.lua @@ -1,6 +1,6 @@ -classInstance:colonMethod() -classInstance.dotMethod() -interfaceInstance:colonMethod() -interfaceInstance.dotMethod() -TestNameSpace.dotMethod() -TestNameSpace.dotMethod2() +classInstance:colonMethod(); +classInstance.dotMethod(); +interfaceInstance:colonMethod(); +interfaceInstance.dotMethod(); +TestNameSpace.dotMethod(); +TestNameSpace.dotMethod2(); diff --git a/test/translation/lua/enumMembersOnly.lua b/test/translation/lua/enumMembersOnly.lua index e257d15f3..f83e2bfc1 100644 --- a/test/translation/lua/enumMembersOnly.lua +++ b/test/translation/lua/enumMembersOnly.lua @@ -2,4 +2,4 @@ val1=0 val2=2 val3=3 val4="bye" -local a = val1 \ No newline at end of file +local a = val1; \ No newline at end of file diff --git a/test/translation/lua/getSetAccessors.lua b/test/translation/lua/getSetAccessors.lua index 082998267..975feb1d2 100644 --- a/test/translation/lua/getSetAccessors.lua +++ b/test/translation/lua/getSetAccessors.lua @@ -11,11 +11,9 @@ function MyClass.get__field(self) return self._field+4 end function MyClass.set__field(self,v) - self._field = (v*2) + self._field = (v*2); end -local instance = MyClass.new(true) - -instance:set__field(4) -local b = instance:get__field() - -local c = (4+instance:get__field())*3 +local instance = MyClass.new(true); +instance:set__field(4); +local b = instance:get__field(); +local c = (4+instance:get__field())*3; diff --git a/test/translation/lua/interfaceIndex.lua b/test/translation/lua/interfaceIndex.lua index 6ad0e98ae..5b329c5ac 100644 --- a/test/translation/lua/interfaceIndex.lua +++ b/test/translation/lua/interfaceIndex.lua @@ -1,3 +1,2 @@ -local a = {} - -a["abc"] = "def" +local a = {}; +a["abc"] = "def"; diff --git a/test/translation/lua/modulesChangedVariableExport.lua b/test/translation/lua/modulesChangedVariableExport.lua index 04cbb6371..0c5c579bf 100644 --- a/test/translation/lua/modulesChangedVariableExport.lua +++ b/test/translation/lua/modulesChangedVariableExport.lua @@ -1,6 +1,5 @@ local exports = exports or {} -local test = nil - -test = 1 +local test = nil; +test = 1; exports.test = test return exports \ No newline at end of file diff --git a/test/translation/lua/modulesVariableExport.lua b/test/translation/lua/modulesVariableExport.lua index c453b7d3f..3ecfdc4c3 100644 --- a/test/translation/lua/modulesVariableExport.lua +++ b/test/translation/lua/modulesVariableExport.lua @@ -1,5 +1,4 @@ local exports = exports or {} -local test = "test" - +local test = "test"; exports.test = test return exports diff --git a/test/translation/lua/modulesVariableNoExport.lua b/test/translation/lua/modulesVariableNoExport.lua index 7aa9c4047..f20c4efeb 100644 --- a/test/translation/lua/modulesVariableNoExport.lua +++ b/test/translation/lua/modulesVariableNoExport.lua @@ -1 +1 @@ -local test = "test" +local test = "test"; diff --git a/test/translation/lua/shorthandPropertyAssignment.lua b/test/translation/lua/shorthandPropertyAssignment.lua index 61f501c56..fb515bf23 100644 --- a/test/translation/lua/shorthandPropertyAssignment.lua +++ b/test/translation/lua/shorthandPropertyAssignment.lua @@ -1 +1 @@ -local f = function(x) return ({x = x}) end +local f = function(x) return ({x = x}) end; diff --git a/test/translation/lua/tryCatch.lua b/test/translation/lua/tryCatch.lua index 39edd63c4..082aafc57 100644 --- a/test/translation/lua/tryCatch.lua +++ b/test/translation/lua/tryCatch.lua @@ -1,8 +1,6 @@ xpcall(function() - local a = 42 - + local a = 42; end, function(er) - local b = "fail" - + local b = "fail"; end) diff --git a/test/translation/lua/tryCatchFinally.lua b/test/translation/lua/tryCatchFinally.lua index 8069a1d99..c08fa2bc4 100644 --- a/test/translation/lua/tryCatchFinally.lua +++ b/test/translation/lua/tryCatchFinally.lua @@ -1,9 +1,7 @@ xpcall(function() - local a = 42 - + local a = 42; end, function(er) - local b = "fail" - + local b = "fail"; end) -local c = "finally" +local c = "finally"; diff --git a/test/translation/lua/tryFinally.lua b/test/translation/lua/tryFinally.lua index 078920e80..4eb2f1c34 100644 --- a/test/translation/lua/tryFinally.lua +++ b/test/translation/lua/tryFinally.lua @@ -1,7 +1,6 @@ xpcall(function() - local a = 42 - + local a = 42; end, function(e) end) -local b = "finally" +local b = "finally"; diff --git a/test/translation/lua/typeAssert.lua b/test/translation/lua/typeAssert.lua index 09dc9e405..1c7069d36 100644 --- a/test/translation/lua/typeAssert.lua +++ b/test/translation/lua/typeAssert.lua @@ -1,3 +1,2 @@ -local test1 = 10 - -local test2 = 10 +local test1 = 10; +local test2 = 10; diff --git a/test/translation/lua/while.lua b/test/translation/lua/while.lua index 5b258106e..4b5a20056 100644 --- a/test/translation/lua/while.lua +++ b/test/translation/lua/while.lua @@ -1,8 +1,7 @@ -local d = 10 - +local d = 10; while d>0 do do - d = (d-1) + d = (d-1); end ::__continue0:: end diff --git a/test/unit/assignmentDestructuring.spec.ts b/test/unit/assignmentDestructuring.spec.ts index f2d373632..650e13024 100644 --- a/test/unit/assignmentDestructuring.spec.ts +++ b/test/unit/assignmentDestructuring.spec.ts @@ -15,7 +15,7 @@ export class AssignmentDestructuringTests { this.assignmentDestruturingTs, {luaTarget: LuaTarget.Lua51, luaLibImport: "none"} ); // Assert - Expect(lua).toBe(`local a,b=unpack(myFunc())`); + Expect(lua).toBe(`local a,b=unpack(myFunc());`); } @Test("Assignment destructuring [5.2]") @@ -25,6 +25,6 @@ export class AssignmentDestructuringTests { this.assignmentDestruturingTs, {luaTarget: LuaTarget.Lua52, luaLibImport: "none"} ); // Assert - Expect(lua).toBe(`local a,b=table.unpack(myFunc())`); + Expect(lua).toBe(`local a,b=table.unpack(myFunc());`); } } diff --git a/test/unit/assignments.spec.ts b/test/unit/assignments.spec.ts index 372a07ace..e3ccb60c0 100644 --- a/test/unit/assignments.spec.ts +++ b/test/unit/assignments.spec.ts @@ -15,7 +15,7 @@ export class AssignmentTests { @Test("Const assignment") public constAssignment(inp: string, out: string): void { const lua = util.transpileString(`const myvar = ${inp};`); - Expect(lua).toBe(`local myvar = ${out}`); + Expect(lua).toBe(`local myvar = ${out};`); } @TestCase(`"abc"`, `"abc"`) @@ -27,7 +27,7 @@ export class AssignmentTests { @Test("Const assignment") public letAssignment(inp: string, out: string): void { const lua = util.transpileString(`let myvar = ${inp};`); - Expect(lua).toBe(`local myvar = ${out}`); + Expect(lua).toBe(`local myvar = ${out};`); } @TestCase(`"abc"`, `"abc"`) @@ -39,7 +39,7 @@ export class AssignmentTests { @Test("Const assignment") public varAssignment(inp: string, out: string): void { const lua = util.transpileString(`var myvar = ${inp};`); - Expect(lua).toBe(`local myvar = ${out}`); + Expect(lua).toBe(`local myvar = ${out};`); } @TestCase("var myvar;") @@ -81,7 +81,7 @@ export class AssignmentTests { + `let [a,b] = abc();`; const lua = util.transpileString(code); - Expect(lua).toBe("local a,b=abc()"); + Expect(lua).toBe("local a,b=abc();"); } @Test("TupleReturn Single assignment") @@ -92,7 +92,7 @@ export class AssignmentTests { + `a = abc();`; const lua = util.transpileString(code); - Expect(lua).toBe("local a = ({ abc() })\n\na = ({ abc() })"); + Expect(lua).toBe("local a = ({ abc() });\na = ({ abc() });"); } @Test("TupleReturn interface assignment") @@ -104,7 +104,7 @@ export class AssignmentTests { + `let [a,b] = jkl.abc();`; const lua = util.transpileString(code); - Expect(lua).toBe("local a,b=jkl:abc()"); + Expect(lua).toBe("local a,b=jkl:abc();"); } @Test("TupleReturn namespace assignment") @@ -116,7 +116,7 @@ export class AssignmentTests { + `let [a,b] = def.abc();`; const lua = util.transpileString(code); - Expect(lua).toBe("local a,b=def.abc()"); + Expect(lua).toBe("local a,b=def.abc();"); } @Test("TupleReturn method assignment") @@ -128,7 +128,7 @@ export class AssignmentTests { + `let [a,b] = jkl.abc();`; const lua = util.transpileString(code); - Expect(lua).toBe("local jkl = def.new(true)\n\nlocal a,b=jkl:abc()"); + Expect(lua).toBe("local jkl = def.new(true);\nlocal a,b=jkl:abc();"); } @Test("TupleReturn functional") diff --git a/test/unit/class.spec.ts b/test/unit/class.spec.ts index dd197de4e..c0bf64d4e 100644 --- a/test/unit/class.spec.ts +++ b/test/unit/class.spec.ts @@ -182,6 +182,33 @@ export class ClassTests { Expect(result).toBe(4); } + @Test("CastClassMethodCall") + public extraParanthesisAssignment() { + // Transpile + const lua = util.transpileString( + `interface result + { + val : number; + } + class a { + public method(out: result) { + out.val += 2; + } + } + let inst:any = new a(); + let result = {val : 0}; + (inst as a).method(result); + (inst as a).method(result); + return result.val;` + ); + + // Execute + const result = util.executeLua(lua); + + // Assert + Expect(result).toBe(4); + } + @Test("ClassInheritedMethodCall") public classInheritedMethodCall(): void { // Transpile diff --git a/test/unit/curry.spec.ts b/test/unit/curry.spec.ts index 99d927ff6..23cd4577f 100644 --- a/test/unit/curry.spec.ts +++ b/test/unit/curry.spec.ts @@ -10,7 +10,7 @@ export class LuaCurryTests { `(x: number) => (y: number) => x + y;` ); // Assert - Expect(lua).toBe(`function(x) return function(y) return x+y end end`); + Expect(lua).toBe(`function(x) return function(y) return x+y end end;`); } @Test("curryingAdd") diff --git a/test/unit/expressions.spec.ts b/test/unit/expressions.spec.ts index 4447f0c2c..69bef8ab1 100644 --- a/test/unit/expressions.spec.ts +++ b/test/unit/expressions.spec.ts @@ -7,14 +7,14 @@ import * as util from "../src/util"; export class ExpressionTests { - @TestCase("i++", "i = (i+1)") - @TestCase("++i", "i = (i+1)") - @TestCase("i--", "i = (i-1)") - @TestCase("--i", "i = (i-1)") - @TestCase("!a", "(not a)") - @TestCase("-a", "-a") - @TestCase("delete tbl['test']", "tbl[\"test\"]=nil") - @TestCase("delete tbl.test", "tbl.test=nil") + @TestCase("i++", "i = (i+1);") + @TestCase("++i", "i = (i+1);") + @TestCase("i--", "i = (i-1);") + @TestCase("--i", "i = (i-1);") + @TestCase("!a", "(not a);") + @TestCase("-a", "-a;") + @TestCase("delete tbl['test']", "tbl[\"test\"]=nil;") + @TestCase("delete tbl.test", "tbl.test=nil;") @Test("Unary expressions basic") public unaryBasic(input: string, lua: string): void { Expect(util.transpileString(input)).toBe(lua); @@ -112,53 +112,53 @@ export class ExpressionTests { .toThrow(); } - @TestCase("~a", "bit.bnot(a)") - @TestCase("a&b", "bit.band(a,b)") - @TestCase("a&=b", "a = (bit.band(a,b))") - @TestCase("a|b", "bit.bor(a,b)") - @TestCase("a|=b", "a = (bit.bor(a,b))") - @TestCase("a^b", "bit.bxor(a,b)") - @TestCase("a^=b", "a = (bit.bxor(a,b))") - @TestCase("a<>b", "bit.rshift(a,b)") - @TestCase("a>>=b", "a = (bit.rshift(a,b))") - @TestCase("a>>>b", "bit.arshift(a,b)") - @TestCase("a>>>=b", "a = (bit.arshift(a,b))") + @TestCase("~a", "bit.bnot(a);") + @TestCase("a&b", "bit.band(a,b);") + @TestCase("a&=b", "a = (bit.band(a,b));") + @TestCase("a|b", "bit.bor(a,b);") + @TestCase("a|=b", "a = (bit.bor(a,b));") + @TestCase("a^b", "bit.bxor(a,b);") + @TestCase("a^=b", "a = (bit.bxor(a,b));") + @TestCase("a<>b", "bit.rshift(a,b);") + @TestCase("a>>=b", "a = (bit.rshift(a,b));") + @TestCase("a>>>b", "bit.arshift(a,b);") + @TestCase("a>>>=b", "a = (bit.arshift(a,b));") @Test("Bitop [JIT]") public bitOperatorOverrideJIT(input: string, lua: string): void { Expect(util.transpileString(input, { luaTarget: LuaTarget.LuaJIT, luaLibImport: "none" })).toBe(lua); } - @TestCase("~a", "bit32.bnot(a)") - @TestCase("a&b", "bit32.band(a,b)") - @TestCase("a&=b", "a = (bit32.band(a,b))") - @TestCase("a|b", "bit32.bor(a,b)") - @TestCase("a|=b", "a = (bit32.bor(a,b))") - @TestCase("a^b", "bit32.bxor(a,b)") - @TestCase("a^=b", "a = (bit32.bxor(a,b))") - @TestCase("a<>b", "bit32.rshift(a,b)") - @TestCase("a>>=b", "a = (bit32.rshift(a,b))") - @TestCase("a>>>b", "bit32.arshift(a,b)") - @TestCase("a>>>=b", "a = (bit32.arshift(a,b))") + @TestCase("~a", "bit32.bnot(a);") + @TestCase("a&b", "bit32.band(a,b);") + @TestCase("a&=b", "a = (bit32.band(a,b));") + @TestCase("a|b", "bit32.bor(a,b);") + @TestCase("a|=b", "a = (bit32.bor(a,b));") + @TestCase("a^b", "bit32.bxor(a,b);") + @TestCase("a^=b", "a = (bit32.bxor(a,b));") + @TestCase("a<>b", "bit32.rshift(a,b);") + @TestCase("a>>=b", "a = (bit32.rshift(a,b));") + @TestCase("a>>>b", "bit32.arshift(a,b);") + @TestCase("a>>>=b", "a = (bit32.arshift(a,b));") @Test("Bitop [5.2]") public bitOperatorOverride52(input: string, lua: string): void { Expect(util.transpileString(input, { luaTarget: LuaTarget.Lua52, luaLibImport: "none" })).toBe(lua); } - @TestCase("~a", "~a") - @TestCase("a&b", "a & b") - @TestCase("a&=b", "a = (a & b)") - @TestCase("a|b", "a | b") - @TestCase("a|=b", "a = (a | b)") - @TestCase("a^b", "a ~ b") - @TestCase("a^=b", "a = (a ~ b)") - @TestCase("a<>b", "a >> b") - @TestCase("a>>=b", "a = (a >> b)") + @TestCase("~a", "~a;") + @TestCase("a&b", "a & b;") + @TestCase("a&=b", "a = (a & b);") + @TestCase("a|b", "a | b;") + @TestCase("a|=b", "a = (a | b);") + @TestCase("a^b", "a ~ b;") + @TestCase("a^=b", "a = (a ~ b);") + @TestCase("a<>b", "a >> b;") + @TestCase("a>>=b", "a = (a >> b);") @Test("Bitop [5.3]") public bitOperatorOverride53(input: string, lua: string): void { Expect(util.transpileString(input, { luaTarget: LuaTarget.Lua53, luaLibImport: "none" })).toBe(lua); @@ -172,11 +172,11 @@ export class ExpressionTests { .toThrowError(TranspileError, "Bitwise >>> operator is/are not supported for target Lua 5.3."); } - @TestCase("1+1", "1+1") - @TestCase("-1+1", "-1+1") - @TestCase("1*30+4", "(1*30)+4") - @TestCase("1*(3+4)", "1*(3+4)") - @TestCase("1*(3+4*2)", "1*(3+(4*2))") + @TestCase("1+1", "1+1;") + @TestCase("-1+1", "-1+1;") + @TestCase("1*30+4", "(1*30)+4;") + @TestCase("1*(3+4)", "1*(3+4);") + @TestCase("1*(3+4*2)", "1*(3+(4*2));") @Test("Binary expressions ordering parentheses") public binaryParentheses(input: string, lua: string): void { Expect(util.transpileString(input)).toBe(lua); @@ -184,12 +184,12 @@ export class ExpressionTests { @Test("Null Expression") public nullExpression(): void { - Expect(util.transpileString("null")).toBe("nil"); + Expect(util.transpileString("null")).toBe("nil;"); } @Test("Undefined Expression") public undefinedExpression(): void { - Expect(util.transpileString("undefined")).toBe("nil"); + Expect(util.transpileString("undefined")).toBe("nil;"); } @TestCase("inst.field", 8) diff --git a/test/unit/math.spec.ts b/test/unit/math.spec.ts index cdab19b27..7e93f7f5b 100644 --- a/test/unit/math.spec.ts +++ b/test/unit/math.spec.ts @@ -5,10 +5,10 @@ export class MathTests { // Dont test all and dont do functional test // because math implementations may differ between js and lua - @TestCase("Math.cos()", "math.cos()") - @TestCase("Math.sin()", "math.sin()") - @TestCase("Math.min()", "math.min()") - @TestCase("Math.PI", "math.pi") + @TestCase("Math.cos()", "math.cos();") + @TestCase("Math.sin()", "math.sin();") + @TestCase("Math.min()", "math.min();") + @TestCase("Math.PI", "math.pi;") @Test("Math") public math(inp: string, expected: string) { // Transpile diff --git a/test/unit/objectLiteral.spec.ts b/test/unit/objectLiteral.spec.ts index 823a998d4..68fa4049d 100644 --- a/test/unit/objectLiteral.spec.ts +++ b/test/unit/objectLiteral.spec.ts @@ -5,12 +5,12 @@ const fs = require("fs"); export class ObjectLiteralTests { - @TestCase(`{a:3,b:"4"}`, `{a = 3,b = "4"}`) - @TestCase(`{"a":3,b:"4"}`, `{["a"] = 3,b = "4"}`) - @TestCase(`{["a"]:3,b:"4"}`, `{["a"] = 3,b = "4"}`) - @TestCase(`{["a"+123]:3,b:"4"}`, `{["a" .. 123] = 3,b = "4"}`) - @TestCase(`{[myFunc()]:3,b:"4"}`, `{[myFunc()] = 3,b = "4"}`) - @TestCase(`{x}`, `{x = x}`) + @TestCase(`{a:3,b:"4"}`, `{a = 3,b = "4"};`) + @TestCase(`{"a":3,b:"4"}`, `{["a"] = 3,b = "4"};`) + @TestCase(`{["a"]:3,b:"4"}`, `{["a"] = 3,b = "4"};`) + @TestCase(`{["a"+123]:3,b:"4"}`, `{["a" .. 123] = 3,b = "4"};`) + @TestCase(`{[myFunc()]:3,b:"4"}`, `{[myFunc()] = 3,b = "4"};`) + @TestCase(`{x}`, `{x = x};`) @Test("Object Literal") public objectLiteral(inp: string, out: string) { var lua = util.transpileString(`const myvar = ${inp};`)