Skip to content

Commit 5c70288

Browse files
committed
Added ComputedPropertyName exrpession
1 parent 99913de commit 5c70288

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

dist/Transpiler.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,10 @@ var LuaTranspiler = /** @class */ (function () {
314314
return this.transpileFunctionExpression(node);
315315
case ts.SyntaxKind.NewExpression:
316316
return this.transpileNewExpression(node);
317+
case ts.SyntaxKind.ComputedPropertyName:
318+
return "[" + this.transpileExpression(node.expression) + "]";
317319
case ts.SyntaxKind.SuperKeyword:
318-
return "self.__base.constructor";
320+
return "self.__base";
319321
case ts.SyntaxKind.TypeAssertionExpression:
320322
// Simply ignore the type assertion
321323
return this.transpileExpression(node.expression);
@@ -429,7 +431,7 @@ var LuaTranspiler = /** @class */ (function () {
429431
if (node.expression.kind == ts.SyntaxKind.SuperKeyword) {
430432
var callPath_2 = this.transpileExpression(node.expression);
431433
var params_2 = this.transpileArguments(node.arguments, ts.createNode(ts.SyntaxKind.ThisKeyword));
432-
return callPath_2 + "(" + params_2 + ")";
434+
return "$self.__base.constructor(" + params_2 + ")";
433435
}
434436
var callPath = this.transpileExpression(node.expression);
435437
var params = this.transpileArguments(node.arguments);
@@ -664,7 +666,7 @@ var LuaTranspiler = /** @class */ (function () {
664666
}
665667
else {
666668
var index = _this.transpileExpression(key);
667-
properties.push("[" + index + "]=" + _this.transpileExpression(value));
669+
properties.push(index + "=" + _this.transpileExpression(value));
668670
}
669671
});
670672
return "{" + properties.join(",") + "}";

src/Transpiler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,10 @@ export class LuaTranspiler {
346346
return this.transpileFunctionExpression(<ts.FunctionExpression>node);
347347
case ts.SyntaxKind.NewExpression:
348348
return this.transpileNewExpression(<ts.NewExpression>node);
349+
case ts.SyntaxKind.ComputedPropertyName:
350+
return "[" + this.transpileExpression((<ts.ComputedPropertyName>node).expression) + "]";
349351
case ts.SyntaxKind.SuperKeyword:
350-
return "self.__base.constructor";
352+
return "self.__base";
351353
case ts.SyntaxKind.TypeAssertionExpression:
352354
// Simply ignore the type assertion
353355
return this.transpileExpression((<ts.TypeAssertion>node).expression);
@@ -473,7 +475,7 @@ export class LuaTranspiler {
473475
if (node.expression.kind == ts.SyntaxKind.SuperKeyword) {
474476
let callPath = this.transpileExpression(node.expression);
475477
const params = this.transpileArguments(node.arguments, <ts.Expression>ts.createNode(ts.SyntaxKind.ThisKeyword));
476-
return `${callPath}(${params})`;
478+
return `$self.__base.constructor(${params})`;
477479
}
478480

479481
let callPath = this.transpileExpression(node.expression);
@@ -750,7 +752,7 @@ export class LuaTranspiler {
750752
properties.push(`["${key.escapedText}"]=`+this.transpileExpression(value));
751753
} else {
752754
const index = this.transpileExpression(<ts.Expression>key);
753-
properties.push(`[${index}]=`+this.transpileExpression(value));
755+
properties.push(`${index}=`+this.transpileExpression(value));
754756
}
755757
});
756758

0 commit comments

Comments
 (0)