typescript-to-lua
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -755,3 +755,3 @@ "use strict"; | ||
var name = this.transpileExpression(node.expression); | ||
var params = this.transpileArguments(node.arguments, ts.createTrue()); | ||
var params = node.arguments ? this.transpileArguments(node.arguments, ts.createTrue()) : "true"; | ||
return name + ".new(" + params + ")"; | ||
@@ -1042,8 +1042,24 @@ }; | ||
var paramNames = []; | ||
parameters.forEach(function (param) { | ||
paramNames.push(param.name.escapedText); | ||
}); | ||
var spreadIdentifier = ""; | ||
// Only push parameter name to paramName array if it isn't a spread parameter | ||
for (var _i = 0, parameters_1 = parameters; _i < parameters_1.length; _i++) { | ||
var param = parameters_1[_i]; | ||
var paramName = param.name.escapedText; | ||
// This parameter is a spread parameter (...param) | ||
if (!param.dotDotDotToken) { | ||
paramNames.push(paramName); | ||
} | ||
else { | ||
spreadIdentifier = paramName; | ||
// Push the spread operator into the paramNames array | ||
paramNames.push("..."); | ||
} | ||
} | ||
// Build function header | ||
result += this.indent + this.accessPrefix(node) + ("function " + methodName + "(" + paramNames.join(",") + ")\n"); | ||
this.pushIndent(); | ||
// Push spread operator here | ||
if (spreadIdentifier !== "") { | ||
result += " local " + spreadIdentifier + " = { ... }\n"; | ||
} | ||
result += this.transpileBlock(body); | ||
@@ -1050,0 +1066,0 @@ this.popIndent(); |
{ | ||
"name": "typescript-to-lua", | ||
"license": "MIT", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"repository": "https://github.com/Perryvw/TypescriptToLua", | ||
@@ -24,15 +24,15 @@ "scripts": { | ||
"dependencies": { | ||
"yargs": "^11.0.0", | ||
"typescript": "^2.7.2" | ||
"typescript": "^2.8.3", | ||
"yargs": "^11.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^9.4.7", | ||
"@types/node": "^9.6.7", | ||
"@types/yargs": "^11.0.0", | ||
"alsatian": "^2.2.1", | ||
"codecov": "^3.0.0", | ||
"codecov": "^3.0.1", | ||
"deep-equal": "^1.0.1", | ||
"lua.vm.js": "0.0.1", | ||
"nyc": "^11.5.0", | ||
"nyc": "^11.7.1", | ||
"tslint": "^5.9.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83960
1639
Updatedtypescript@^2.8.3
Updatedyargs@^11.1.0