typescript-to-lua 1.16.0 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -115,9 +115,8 @@ function transformClassLikeDeclaration(classDeclaration, context, nameOverride)
115
115
  }
116
116
  else if (ts.isMethodDeclaration(member)) {
117
117
  // Methods
118
- const statement = (0, method_1.transformMethodDeclaration)(context, member, localClassName);
119
- if (statement)
120
- result.push(statement);
118
+ const statements = (0, method_1.transformMethodDeclaration)(context, member, localClassName);
119
+ result.push(...statements);
121
120
  }
122
121
  else if (ts.isPropertyDeclaration(member)) {
123
122
  // Properties
@@ -3,4 +3,4 @@ import * as lua from "../../../../LuaAST";
3
3
  import { TransformationContext } from "../../../context";
4
4
  export declare function transformMemberExpressionOwnerName(node: ts.PropertyDeclaration | ts.MethodDeclaration | ts.AccessorDeclaration, className: lua.Identifier): lua.Expression;
5
5
  export declare function transformMethodName(context: TransformationContext, node: ts.MethodDeclaration): lua.Expression;
6
- export declare function transformMethodDeclaration(context: TransformationContext, node: ts.MethodDeclaration, className: lua.Identifier): lua.Statement | undefined;
6
+ export declare function transformMethodDeclaration(context: TransformationContext, node: ts.MethodDeclaration, className: lua.Identifier): lua.Statement[];
@@ -24,7 +24,7 @@ function transformMethodDeclaration(context, node, className) {
24
24
  var _a, _b;
25
25
  // Don't transform methods without body (overload declarations)
26
26
  if (!node.body)
27
- return;
27
+ return [];
28
28
  const methodTable = transformMemberExpressionOwnerName(node, className);
29
29
  const methodName = transformMethodName(context, node);
30
30
  const [functionExpression] = (0, function_1.transformFunctionToExpression)(context, node);
@@ -33,14 +33,21 @@ function transformMethodDeclaration(context, node, className) {
33
33
  if (methodHasDecorators || methodHasParameterDecorators) {
34
34
  if (context.options.experimentalDecorators) {
35
35
  // Legacy decorator statement
36
- return lua.createExpressionStatement((0, decorators_1.createClassMethodDecoratingExpression)(context, node, functionExpression, className));
36
+ return [
37
+ lua.createAssignmentStatement(lua.createTableIndexExpression(methodTable, methodName), functionExpression),
38
+ lua.createExpressionStatement((0, decorators_1.createClassMethodDecoratingExpression)(context, node, functionExpression, className)),
39
+ ];
37
40
  }
38
41
  else {
39
- return lua.createAssignmentStatement(lua.createTableIndexExpression(methodTable, methodName), (0, decorators_1.createClassMethodDecoratingExpression)(context, node, functionExpression, className), node);
42
+ return [
43
+ lua.createAssignmentStatement(lua.createTableIndexExpression(methodTable, methodName), (0, decorators_1.createClassMethodDecoratingExpression)(context, node, functionExpression, className), node),
44
+ ];
40
45
  }
41
46
  }
42
47
  else {
43
- return lua.createAssignmentStatement(lua.createTableIndexExpression(methodTable, methodName), functionExpression, node);
48
+ return [
49
+ lua.createAssignmentStatement(lua.createTableIndexExpression(methodTable, methodName), functionExpression, node),
50
+ ];
44
51
  }
45
52
  }
46
53
  exports.transformMethodDeclaration = transformMethodDeclaration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-to-lua",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!",
5
5
  "repository": "https://github.com/TypeScriptToLua/TypeScriptToLua",
6
6
  "homepage": "https://typescripttolua.github.io/",