roblox-ts
Version:
<div align="center"><img width=25% src="https://i.imgur.com/yCjHmng.png"></div> <h1 align="center"><a href="https://roblox-ts.github.io/">roblox-ts</a></h1> <div align="center">A TypeScript-to-Lua Compiler for Roblox</div> <br> <div align="center"> <a hr
30 lines • 1 kB
JavaScript
;
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const ts = __importStar(require("ts-morph"));
const _1 = require(".");
function compileBlock(state, node) {
if (node.getStatements().length === 0) {
return "";
}
let result = "";
const parent = node.getParentIfKind(ts.SyntaxKind.SourceFile) || node.getParentIfKind(ts.SyntaxKind.Block);
if (parent) {
result += state.indent + "do\n";
state.pushIndent();
}
result += _1.compileStatementedNode(state, node);
if (parent) {
state.popIndent();
result += state.indent + "end;\n";
}
return result;
}
exports.compileBlock = compileBlock;
//# sourceMappingURL=block.js.map