Skip to content

Commit e163745

Browse files
committed
Fixed #92
1 parent b54ecd1 commit e163745

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/Transpiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ export class LuaTranspiler {
833833

834834
public transpileNewExpression(node: ts.NewExpression): string {
835835
const name = this.transpileExpression(node.expression);
836-
const params = this.transpileArguments(node.arguments, ts.createTrue());
836+
const params = node.arguments ? this.transpileArguments(node.arguments, ts.createTrue()) : "true";
837837

838838
return `${name}.new(${params})`;
839839
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Test = Test or {}
2+
Test.__index = Test
3+
function Test.new(construct, ...)
4+
local instance = setmetatable({}, Test)
5+
if construct and Test.constructor then Test.constructor(instance, ...) end
6+
return instance
7+
end
8+
function Test.constructor(self)
9+
end
10+
local t = Test.new(true)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Test {
2+
constructor () {
3+
4+
}
5+
}
6+
7+
let t = new Test;

0 commit comments

Comments
 (0)