UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

32 lines (30 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArrForEachHelper = void 0; const Helper_1 = require("../Helper"); class ArrForEachHelper extends Helper_1.Helper { constructor(options) { super(); this.each = options.each; this.withIndex = options.withIndex || false; } emit(sb, node, options) { if (this.withIndex) { sb.emitSysCall(node, 'Neo.Iterator.Create'); sb.emitHelper(node, options, sb.helpers.rawIteratorForEach({ each: (innerOptions) => { sb.emitOp(node, 'SWAP'); this.each(innerOptions); }, })); } else { sb.emitSysCall(node, 'Neo.Enumerator.Create'); sb.emitHelper(node, options, sb.helpers.rawEnumeratorForEach({ each: this.each, })); } } } exports.ArrForEachHelper = ArrForEachHelper; //# sourceMappingURL=ArrForEachHelper.js.map