Skip to content

Commit 4899d68

Browse files
committed
call functions on object literals with a dot
1 parent 27c7d42 commit 4899d68

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/Transpiler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,8 @@ export class LuaTranspiler {
917917
return this.transpileArrayCallExpression(node);
918918
}
919919

920-
if (expType.symbol && (expType.symbol.flags & ts.SymbolFlags.Namespace)) {
920+
if (expType.symbol && ((expType.symbol.flags & ts.SymbolFlags.Namespace)
921+
|| (expType.symbol.flags & ts.SymbolFlags.TypeLiteral))) {
921922
// Don't replace . with : for namespaces
922923
callPath = this.transpileExpression(node.expression);
923924
params = this.transpileArguments(node.arguments);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
classInstance:colonMethod()
2+
interfaceInstance:colonMethod()
3+
wrapperObj.dotMethod()
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
declare class TestClass {
2+
public colonMethod(): void;
3+
}
4+
5+
declare interface TestInterface {
6+
colonMethod(): void;
7+
}
8+
9+
declare var wrapperObj: { dotMethod: () => void };
10+
11+
declare const classInstance: TestClass;
12+
declare const interfaceInstance: TestInterface;
13+
14+
classInstance.colonMethod();
15+
interfaceInstance.colonMethod();
16+
wrapperObj.dotMethod();

0 commit comments

Comments
 (0)