UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

37 lines (35 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateConstructArrayHelper = void 0; const Helper_1 = require("../Helper"); class CreateConstructArrayHelper extends Helper_1.Helper { constructor({ body, withScope }) { super(); this.body = body; this.withScope = withScope; } emit(sb, node, outerOptions) { if (!outerOptions.pushValue) { return; } const emit = (options) => { this.body(sb.noPushValueOptions(options)); sb.emitHelper(node, sb.pushValueOptions(options), sb.helpers.wrapUndefined); sb.emitHelper(node, options, sb.helpers.return); }; sb.emitHelper(node, outerOptions, sb.helpers.createFunctionArray({ body: (innerOptions) => { if (this.withScope) { sb.withScope(node, innerOptions, (options) => { emit(options); }); } else { emit(innerOptions); } }, })); } } exports.CreateConstructArrayHelper = CreateConstructArrayHelper; //# sourceMappingURL=CreateConstructArrayHelper.js.map