Skip to content

Commit ce44bfb

Browse files
committed
Changed calls to [type].func([instance], ...) in front of [instance].func([instance], ...)
1 parent 8d55c98 commit ce44bfb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

dist/Transpiler.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ var LuaTranspiler = /** @class */ (function () {
496496
return this.transpileArrayCallExpression(node);
497497
}
498498
// Include context parameter if present
499-
var callPath_1 = this.transpileExpression(node.expression);
499+
var expType = this.checker.getTypeAtLocation(node.expression.expression);
500+
var callPath_1 = (expType && expType.symbol) ? expType.symbol.name + "." + node.expression.name.escapedText : this.transpileExpression(node.expression);
500501
var params_1 = this.transpileArguments(node.arguments, node.expression.expression);
501502
return callPath_1 + "(" + params_1 + ")";
502503
}
@@ -561,6 +562,8 @@ var LuaTranspiler = /** @class */ (function () {
561562
return "TS_slice(" + caller + ", " + params + ")";
562563
case "splice":
563564
return "TS_splice(" + caller + ", " + params + ")";
565+
case "join":
566+
return "table.concat(" + caller + ", " + params + ")";
564567
default:
565568
throw new TranspileError("Unsupported array function: " + expression.name.escapedText, node);
566569
}

src/Transpiler.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,10 @@ export class LuaTranspiler {
540540
}
541541

542542
// Include context parameter if present
543-
let callPath = this.transpileExpression(node.expression);
544-
const params = this.transpileArguments(node.arguments, node.expression.expression);
543+
const expType = this.checker.getTypeAtLocation(node.expression.expression);
544+
let callPath = (expType && expType.symbol) ? `${expType.symbol.name}.${node.expression.name.escapedText}` : this.transpileExpression(node.expression);
545+
let params = this.transpileArguments(node.arguments, node.expression.expression);
546+
545547
return `${callPath}(${params})`;
546548
}
547549

0 commit comments

Comments
 (0)