UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

30 lines (28 loc) 879 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CaseHelper = void 0; const Helper_1 = require("../Helper"); class CaseHelper extends Helper_1.Helper { constructor(cases, defaultCase) { super(); this.cases = cases; this.defaultCase = defaultCase; } emit(sb, node, options) { this.addCase(sb, node, options); } addCase(sb, node, options, idx = 0) { if (idx >= this.cases.length) { this.defaultCase(); } else { sb.emitHelper(node, options, sb.helpers.if({ condition: this.cases[idx].condition, whenTrue: this.cases[idx].whenTrue, whenFalse: () => this.addCase(sb, node, options, idx + 1), })); } } } exports.CaseHelper = CaseHelper; //# sourceMappingURL=CaseHelper.js.map