typescript-to-lua
Advanced tools
Comparing version 1.13.3 to 1.14.0
@@ -673,3 +673,2 @@ "use strict"; | ||
} | ||
exports.LuaPrinter = LuaPrinter; | ||
LuaPrinter.operatorMap = { | ||
@@ -731,2 +730,3 @@ [lua.SyntaxKind.AdditionOperator]: "+", | ||
LuaPrinter.sourceMapTracebackPlaceholder = "{#SourceMapTraceback}"; | ||
exports.LuaPrinter = LuaPrinter; | ||
//# sourceMappingURL=LuaPrinter.js.map |
@@ -97,3 +97,9 @@ "use strict"; | ||
function getSignatureDeclarations(context, signature) { | ||
if (signature.compositeSignatures) { | ||
return signature.compositeSignatures.flatMap(s => getSignatureDeclarations(context, s)); | ||
} | ||
const signatureDeclaration = signature.getDeclaration(); | ||
if (signatureDeclaration === undefined) { | ||
return []; | ||
} | ||
let inferredType; | ||
@@ -100,0 +106,0 @@ if (ts.isMethodDeclaration(signatureDeclaration) && |
@@ -33,3 +33,8 @@ "use strict"; | ||
} | ||
return (_b = (_a = declaration.modifiers) === null || _a === void 0 ? void 0 : _a.some(m => m.kind === ts.SyntaxKind.AsyncKeyword)) !== null && _b !== void 0 ? _b : false; | ||
if (ts.canHaveModifiers(declaration)) { | ||
return (_b = (_a = ts.getModifiers(declaration)) === null || _a === void 0 ? void 0 : _a.some(m => m.kind === ts.SyntaxKind.AsyncKeyword)) !== null && _b !== void 0 ? _b : false; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
@@ -36,0 +41,0 @@ exports.isInAsyncFunction = isInAsyncFunction; |
@@ -12,2 +12,3 @@ "use strict"; | ||
const lualib_1 = require("../../utils/lualib"); | ||
const diagnostics_1 = require("../../utils/diagnostics"); | ||
function isLuaExpressionWithSideEffect(expression) { | ||
@@ -47,3 +48,7 @@ return !(lua.isLiteral(expression) || lua.isIdentifier(expression)); | ||
} | ||
const left = (0, utils_1.cast)(context.transformExpression(lhs), lua.isAssignmentLeftHandSideExpression); | ||
const left = context.transformExpression(lhs); | ||
if (!lua.isAssignmentLeftHandSideExpression(left)) { | ||
context.diagnostics.push((0, diagnostics_1.cannotAssignToNodeOfKind)(expression, left.kind)); | ||
return { precedingStatements: [], result: left }; | ||
} | ||
const { precedingStatements: rightPrecedingStatements, result: right } = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(rhs)); | ||
@@ -133,3 +138,7 @@ if (lua.isTableIndexExpression(left)) { | ||
} | ||
const left = (0, utils_1.cast)(context.transformExpression(lhs), lua.isAssignmentLeftHandSideExpression); | ||
const left = context.transformExpression(lhs); | ||
if (!lua.isAssignmentLeftHandSideExpression(left)) { | ||
context.diagnostics.push((0, diagnostics_1.cannotAssignToNodeOfKind)(node, left.kind)); | ||
return []; | ||
} | ||
const { precedingStatements: rightPrecedingStatements, result: right } = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(rhs)); | ||
@@ -136,0 +145,0 @@ if (lua.isTableIndexExpression(left) && shouldCacheTableIndexExpressions(left, rightPrecedingStatements)) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.transformNewExpression = void 0; | ||
const ts = require("typescript"); | ||
const lua = require("../../../LuaAST"); | ||
@@ -17,3 +16,3 @@ const annotations_1 = require("../../utils/annotations"); | ||
const signature = context.checker.getResolvedSignature(node); | ||
const [name, params] = (0, call_1.transformCallAndArguments)(context, node.expression, (_a = node.arguments) !== null && _a !== void 0 ? _a : [ts.factory.createTrue()], signature); | ||
const [name, params] = (0, call_1.transformCallAndArguments)(context, node.expression, (_a = node.arguments) !== null && _a !== void 0 ? _a : [], signature); | ||
const type = context.checker.getTypeAtLocation(node); | ||
@@ -20,0 +19,0 @@ const annotations = (0, annotations_1.getTypeAnnotations)(type); |
@@ -34,3 +34,4 @@ "use strict"; | ||
// Scope cannot be an async function | ||
if ((_a = scope.node.modifiers) === null || _a === void 0 ? void 0 : _a.some(m => m.kind === ts.SyntaxKind.AsyncKeyword)) { | ||
if (ts.canHaveModifiers(scope.node) && | ||
((_a = ts.getModifiers(scope.node)) === null || _a === void 0 ? void 0 : _a.some(m => m.kind === ts.SyntaxKind.AsyncKeyword))) { | ||
return false; | ||
@@ -37,0 +38,0 @@ } |
@@ -69,3 +69,3 @@ "use strict"; | ||
} | ||
return ts.visitNode(sourceFile, visit); | ||
return ts.visitEachChild(sourceFile, visit, context); | ||
}; | ||
@@ -72,0 +72,0 @@ exports.stripParenthesisExpressionsTransformer = stripParenthesisExpressionsTransformer; |
{ | ||
"name": "typescript-to-lua", | ||
"version": "1.13.3", | ||
"version": "1.14.0", | ||
"description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!", | ||
@@ -45,3 +45,3 @@ "repository": "https://github.com/TypeScriptToLua/TypeScriptToLua", | ||
"peerDependencies": { | ||
"typescript": "~4.9.3" | ||
"typescript": "^5.0.2" | ||
}, | ||
@@ -60,5 +60,5 @@ "dependencies": { | ||
"@types/resolve": "1.14.0", | ||
"@typescript-eslint/eslint-plugin": "^5.52.0", | ||
"@typescript-eslint/parser": "^5.52.0", | ||
"eslint": "^8.34.0", | ||
"@typescript-eslint/eslint-plugin": "^5.55.0", | ||
"@typescript-eslint/parser": "^5.55.0", | ||
"eslint": "^8.36.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
@@ -69,10 +69,10 @@ "eslint-plugin-jest": "^26.9.0", | ||
"jest": "^28.1.3", | ||
"jest-circus": "^29.4.2", | ||
"jest-circus": "^29.5.0", | ||
"lua-types": "^2.13.0", | ||
"lua-wasm-bindings": "^0.3.1", | ||
"prettier": "^2.3.2", | ||
"prettier": "^2.8.4", | ||
"ts-jest": "^28.0.8", | ||
"ts-node": "^10.9.1", | ||
"typescript": "~4.9.3" | ||
"typescript": "^5.0.2" | ||
} | ||
} |
1039224
14846