typescript-to-lua
Advanced tools
Comparing version 1.16.3 to 1.17.0
@@ -53,3 +53,5 @@ import * as ts from "typescript"; | ||
TableAddKeyType = "TableAddKey", | ||
TableAddKeyMethodType = "TableAddKeyMethod" | ||
TableAddKeyMethodType = "TableAddKeyMethod", | ||
TableIsEmptyType = "TableIsEmpty", | ||
TableIsEmptyMethodType = "TableIsEmptyMethod" | ||
} | ||
@@ -56,0 +58,0 @@ export declare function getExtensionKindForType(context: TransformationContext, type: ts.Type): ExtensionKind | undefined; |
@@ -58,2 +58,4 @@ "use strict"; | ||
ExtensionKind["TableAddKeyMethodType"] = "TableAddKeyMethod"; | ||
ExtensionKind["TableIsEmptyType"] = "TableIsEmpty"; | ||
ExtensionKind["TableIsEmptyMethodType"] = "TableIsEmptyMethod"; | ||
})(ExtensionKind || (exports.ExtensionKind = ExtensionKind = {})); | ||
@@ -117,27 +119,3 @@ const extensionValues = new Set(Object.values(ExtensionKind)); | ||
exports.getIterableExtensionKindForNode = getIterableExtensionKindForNode; | ||
exports.methodExtensionKinds = new Set([ | ||
ExtensionKind.AdditionOperatorMethodType, | ||
ExtensionKind.SubtractionOperatorMethodType, | ||
ExtensionKind.MultiplicationOperatorMethodType, | ||
ExtensionKind.DivisionOperatorMethodType, | ||
ExtensionKind.ModuloOperatorMethodType, | ||
ExtensionKind.PowerOperatorMethodType, | ||
ExtensionKind.FloorDivisionOperatorMethodType, | ||
ExtensionKind.BitwiseAndOperatorMethodType, | ||
ExtensionKind.BitwiseOrOperatorMethodType, | ||
ExtensionKind.BitwiseExclusiveOrOperatorMethodType, | ||
ExtensionKind.BitwiseLeftShiftOperatorMethodType, | ||
ExtensionKind.BitwiseRightShiftOperatorMethodType, | ||
ExtensionKind.ConcatOperatorMethodType, | ||
ExtensionKind.LessThanOperatorMethodType, | ||
ExtensionKind.GreaterThanOperatorMethodType, | ||
ExtensionKind.NegationOperatorMethodType, | ||
ExtensionKind.BitwiseNotOperatorMethodType, | ||
ExtensionKind.LengthOperatorMethodType, | ||
ExtensionKind.TableDeleteMethodType, | ||
ExtensionKind.TableGetMethodType, | ||
ExtensionKind.TableHasMethodType, | ||
ExtensionKind.TableSetMethodType, | ||
ExtensionKind.TableAddKeyMethodType, | ||
]); | ||
exports.methodExtensionKinds = new Set(Object.values(ExtensionKind).filter(key => key.endsWith("Method"))); | ||
function getNaryCallExtensionArgs(context, node, kind, numArgs) { | ||
@@ -144,0 +122,0 @@ let expressions; |
@@ -23,2 +23,4 @@ "use strict"; | ||
[language_extensions_1.ExtensionKind.TableAddKeyMethodType]: transformTableAddKeyExpression, | ||
[language_extensions_1.ExtensionKind.TableIsEmptyType]: transformTableIsEmptyExpression, | ||
[language_extensions_1.ExtensionKind.TableIsEmptyMethodType]: transformTableIsEmptyExpression, | ||
}; | ||
@@ -75,2 +77,11 @@ function transformTableDeleteExpression(context, node, extensionKind) { | ||
} | ||
function transformTableIsEmptyExpression(context, node, extensionKind) { | ||
const args = (0, language_extensions_1.getUnaryCallExtensionArg)(context, node, extensionKind); | ||
if (!args) { | ||
return lua.createNilLiteral(); | ||
} | ||
const table = context.transformExpression(args); | ||
// next(arg0) == nil | ||
return lua.createBinaryExpression(lua.createCallExpression(lua.createIdentifier("next"), [table], node), lua.createNilLiteral(), lua.SyntaxKind.EqualityOperator, node); | ||
} | ||
//# sourceMappingURL=table.js.map |
{ | ||
"name": "typescript-to-lua", | ||
"version": "1.16.3", | ||
"version": "1.17.0", | ||
"description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/TypeScriptToLua/TypeScriptToLua", |
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
1058094
15133