typescript-to-lua
Version:
A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!
23 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformSymbolConstructorCall = transformSymbolConstructorCall;
const lua = require("../../LuaAST");
const diagnostics_1 = require("../utils/diagnostics");
const lualib_1 = require("../utils/lualib");
const call_1 = require("../visitors/call");
function transformSymbolConstructorCall(context, node, calledMethod) {
const signature = context.checker.getResolvedSignature(node);
const parameters = (0, call_1.transformArguments)(context, node.arguments, signature);
const methodName = calledMethod.name.text;
switch (methodName) {
case "for":
case "keyFor":
(0, lualib_1.importLuaLibFeature)(context, lualib_1.LuaLibFeature.SymbolRegistry);
const upperMethodName = methodName[0].toUpperCase() + methodName.slice(1);
const functionIdentifier = lua.createIdentifier(`__TS__SymbolRegistry${upperMethodName}`);
return lua.createCallExpression(functionIdentifier, parameters, node);
default:
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Symbol", methodName));
}
}
//# sourceMappingURL=symbol.js.map